cloudy  trunk
 All Data Structures Namespaces 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-2022 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 "parser.h"
7 
8 #define NUMBEROF(a) (sizeof(a)/sizeof((a)[0]))
9 
10 namespace Time {
11  const double YEAR=3.15569e7,
12  MILLENIUM=YEAR*1000.,
13  CENTURY=YEAR*100.,
14  MONTH=YEAR/12.,
15  FORTNIGHT=(24.*3600.*14.),
16  WEEK=(24.*3600.*7.),
17  DAY=(24.*3600.),
18  HOUR=3600.,
19  MINUTE=60.,
20  SECOND=1.;
21 
23  {
34  };
35 
36 }
37 
38 void ParseAge( Parser &p )
39 {
40  DEBUG_ENTRY( "ParseAge()" );
41 
42  /* set age for the cloud
43  * various timescales will be checked in AgeCheck, called in comment */
44 
45  realnum value = (realnum)p.FFmtRead();
46 
47  /* key " off" turns age off */
48  if( p.lgEOL() && (!p.nWord(" OFF")) )
49  {
50  fprintf( ioQQQ, " The age must be on this line.\n" );
52  }
53 
54  /* check if log of age */
55  if( p.nWord(" LOG") )
56  {
57  value = exp10(value);
58  }
59 
61 
62  timesc.CloudAgeSet = value;
63 
64  return;
65 }
double FFmtRead(void)
Definition: parser.cpp:472
double exp10(double x)
Definition: cddefines.h:1368
void ParseAge(Parser &p)
Definition: parse_age.cpp:38
const double FORTNIGHT
Definition: parse_age.cpp:15
bool parserProcess(Parser &p, T *list, unsigned long nlist, V *value)
Definition: parser.h:273
FILE * ioQQQ
Definition: cddefines.cpp:7
Definition: parser.h:43
const double CENTURY
Definition: parse_age.cpp:13
const double DAY
Definition: parse_age.cpp:17
KeyAction< UnitConverter > TimeUnits[]
Definition: parse_age.cpp:22
const double SECOND
Definition: parse_age.cpp:20
float realnum
Definition: cddefines.h:124
#define EXIT_FAILURE
Definition: cddefines.h:168
const double YEAR
Definition: parse_age.cpp:11
realnum CloudAgeSet
Definition: timesc.h:43
const double WEEK
Definition: parse_age.cpp:16
#define cdEXIT(FAIL)
Definition: cddefines.h:482
const char * nWord(const char *chKey) const
Definition: parser.cpp:32
t_timesc timesc
Definition: timesc.cpp:7
const double MONTH
Definition: parse_age.cpp:14
KeyAction< V > MakeKeyAction(const char *keyword, const V &action)
Definition: parser.h:252
#define NUMBEROF(a)
Definition: parse_age.cpp:8
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
bool lgEOL(void) const
Definition: parser.h:113
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
const double HOUR
Definition: parse_age.cpp:18
const double MILLENIUM
Definition: parse_age.cpp:12
const double MINUTE
Definition: parse_age.cpp:19