cloudy  trunk
parse_age.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2013 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 #include "parser.h"
8 
9 #define NUMBEROF(a) (sizeof(a)/sizeof((a)[0]))
10 
11 namespace Time {
12  const double YEAR=3.15569e7,
13  MILLENIUM=YEAR*1000.,
14  CENTURY=YEAR*100.,
15  MONTH=YEAR/12.,
16  FORTNIGHT=(24.*3600.*14.),
17  WEEK=(24.*3600.*7.),
18  DAY=(24.*3600.),
19  HOUR=3600.,
20  MINUTE=60.,
21  SECOND=1.;
22 
24  {
35  };
36 
37 }
38 
39 void ParseAge( Parser &p )
40 {
41  DEBUG_ENTRY( "ParseAge()" );
42 
43  /* set age for the cloud
44  * various timescales will be checked in AgeCheck, called in comment */
45 
46  realnum value = (realnum)p.FFmtRead();
47 
48  /* key " off" turns age off */
49  if( p.lgEOL() && (!p.nWord(" OFF")) )
50  {
51  fprintf( ioQQQ, " The age must be on this line.\n" );
53  }
54 
55  /* check if log of age */
56  if( p.nWord(" LOG") )
57  {
58  value = (realnum)pow((realnum)10.f, value);
59  }
60 
62 
63  timesc.CloudAgeSet = value;
64 
65  return;
66 }
Time
Definition: parse_age.cpp:11
Time::CENTURY
const double CENTURY
Definition: parse_age.cpp:14
Parser::FFmtRead
double FFmtRead(void)
Definition: parser.cpp:353
Time::TimeUnits
KeyAction< UnitConverter > TimeUnits[]
Definition: parse_age.cpp:23
ParseAge
void ParseAge(Parser &p)
Definition: parse_age.cpp:39
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
Parser::nWord
const char * nWord(const char *chKey) const
Definition: parser.cpp:30
realnum
float realnum
Definition: cddefines.h:103
Time::DAY
const double DAY
Definition: parse_age.cpp:18
Time::FORTNIGHT
const double FORTNIGHT
Definition: parse_age.cpp:16
Time::YEAR
const double YEAR
Definition: parse_age.cpp:12
Time::MONTH
const double MONTH
Definition: parse_age.cpp:15
Time::SECOND
const double SECOND
Definition: parse_age.cpp:21
parse.h
timesc
t_timesc timesc
Definition: timesc.cpp:5
EXIT_FAILURE
#define EXIT_FAILURE
Definition: cddefines.h:140
Parser
Definition: parser.h:31
cddefines.h
Time::HOUR
const double HOUR
Definition: parse_age.cpp:19
t_timesc::CloudAgeSet
realnum CloudAgeSet
Definition: timesc.h:30
Time::MINUTE
const double MINUTE
Definition: parse_age.cpp:20
NUMBEROF
#define NUMBEROF(a)
Definition: parse_age.cpp:9
UnitConverter
Definition: parser.h:257
cdEXIT
#define cdEXIT(FAIL)
Definition: cddefines.h:434
Parser::lgEOL
bool lgEOL(void) const
Definition: parser.h:98
Time::MILLENIUM
const double MILLENIUM
Definition: parse_age.cpp:13
Time::WEEK
const double WEEK
Definition: parse_age.cpp:17
timesc.h
parserProcess
bool parserProcess(Parser &p, T *list, unsigned long nlist, V *value)
Definition: parser.h:272
parser.h
KeyAction
Definition: parser.h:232
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
MakeKeyAction
KeyAction< V > MakeKeyAction(const char *keyword, const V &action)
Definition: parser.h:251