cloudy trunk
Loading...
Searching...
No Matches
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
11namespace Time {
12 const double YEAR=3.15569e7,
16 FORTNIGHT=(24.*3600.*14.),
17 WEEK=(24.*3600.*7.),
18 DAY=(24.*3600.),
19 HOUR=3600.,
20 MINUTE=60.,
22
36
37}
38
39void 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}
FILE * ioQQQ
Definition cddefines.cpp:7
#define EXIT_FAILURE
Definition cddefines.h:140
#define cdEXIT(FAIL)
Definition cddefines.h:434
float realnum
Definition cddefines.h:103
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
double FFmtRead(void)
Definition parser.cpp:353
const char * nWord(const char *chKey) const
Definition parser.cpp:30
bool lgEOL(void) const
Definition parser.h:98
const double HOUR
Definition parse_age.cpp:19
KeyAction< UnitConverter > TimeUnits[]
Definition parse_age.cpp:23
const double DAY
Definition parse_age.cpp:18
const double YEAR
Definition parse_age.cpp:12
const double SECOND
Definition parse_age.cpp:21
const double MINUTE
Definition parse_age.cpp:20
const double FORTNIGHT
Definition parse_age.cpp:16
const double MILLENIUM
Definition parse_age.cpp:13
const double CENTURY
Definition parse_age.cpp:14
const double MONTH
Definition parse_age.cpp:15
const double WEEK
Definition parse_age.cpp:17
#define NUMBEROF(a)
Definition parse_age.cpp:9
void ParseAge(Parser &p)
Definition parse_age.cpp:39
bool parserProcess(Parser &p, T *list, unsigned long nlist, V *value)
Definition parser.h:272
KeyAction< V > MakeKeyAction(const char *keyword, const V &action)
Definition parser.h:251
t_timesc timesc
Definition timesc.cpp:5