cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_age.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*ParseAge parse parameters off the age command */
4 #include "cddefines.h"
5 #include "timesc.h"
6 #include "parse.h"
7 
8 void ParseAge(char *chCard )
9 {
10  bool lgEOL;
11  long int i;
12 
13  DEBUG_ENTRY( "ParseAge()" );
14 
15  /* set age for the cloud
16  * various timescales will be checked in AgeCheck, called in comment */
17 
18  i = 4;
20 
21  /* key " off" turns age off */
22  if( lgEOL && (!nMatch(" OFF",chCard)) )
23  {
24  fprintf( ioQQQ, " The age must be on this line.\n" );
25  cdEXIT(EXIT_FAILURE);
26  }
27 
28  /* check if log of age */
29  if( nMatch(" LOG",chCard) )
30  {
32  }
33 
34  /* check for units, we want seconds in the end */
35  if( nMatch("MILL",chCard) )
36  {
37  /* millennium */
38  timesc.CloudAgeSet *= (realnum)(3.15569e7*1000.);
39  }
40  else if( nMatch("CENT",chCard) )
41  {
42  /* centuries */
43  timesc.CloudAgeSet *= (realnum)(3.15569e7*100.);
44  }
45  else if( nMatch("YEAR",chCard) )
46  {
47  /* years */
48  timesc.CloudAgeSet *= 3.15569e7;
49  }
50  else if( nMatch("MONT",chCard) )
51  {
52  /* months */
53  timesc.CloudAgeSet = (realnum)(timesc.CloudAgeSet*3.15569e7/12.);
54  }
55  else if( nMatch("FORT",chCard) )
56  {
57  /* fortnights */
58  timesc.CloudAgeSet *= 24.f*3600.f*14.f;
59  }
60  else if( nMatch("WEEK",chCard) )
61  {
62  /* weeks */
63  timesc.CloudAgeSet *= 24.f*3600.f*7.f;
64  }
65  else if( nMatch("DAY ",chCard) )
66  {
67  /* days */
68  timesc.CloudAgeSet *= 24.f*3600.f;
69  }
70  else if( nMatch("HOUR",chCard) )
71  {
72  /* hours */
73  timesc.CloudAgeSet *= 3600.f;
74  }
75  else if( nMatch("MINU",chCard) )
76  {
77  /* minuts */
78  timesc.CloudAgeSet *= 60.f;
79  }
80  else if( nMatch("SECO",chCard) )
81  {
82  /* seconds - this is the default */
83  timesc.CloudAgeSet *= 1.f;
84  }
85 
86  return;
87 }

Generated for cloudy by doxygen 1.8.1.2