cloudy  trunk
parse_cosmology.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 /*ParseCosmology parse cosmological parameters and options */
4 #include "cddefines.h"
5 #include "radius.h"
6 #include "rfield.h"
7 #include "parse.h"
8 #include "physconst.h"
9 #include "cosmology.h"
10 #include "parser.h"
11 
13 {
14  realnum param;
15 
16  DEBUG_ENTRY( "ParseCosmology()" );
17 
18  cosmology.lgDo = true;
19 
20  /* set an omega parameter */
21  if( p.nMatch("OMEG") )
22  {
23  param = (realnum)p.FFmtRead();
24 
25  if( p.nMatch( "BARY") )
26  {
27  cosmology.omega_baryon = param;
28  }
29  else if( p.nMatch( "RADI") )
30  {
31  cosmology.omega_rad = param;
32  }
33  else if( p.nMatch( "MATT") )
34  {
35  cosmology.omega_matter = param;
36  }
37  else if( p.nMatch( "LAMB") )
38  {
39  cosmology.omega_lambda = param;
40  }
41  else if( p.nMatch( " K ") || p.nMatch( "CURV") )
42  {
43  cosmology.omega_k = param;
44  }
45  else
46  {
47  // must terminate clause safely
48  fixit();// what should it do?
49  TotalInsanity();
50  }
51  }
52  else if( p.nMatch("HUBB") )
53  {
54  param = (realnum)p.FFmtRead();
55 
56  cosmology.h = param;
57 
58  if( param <= 0 || param > 1.1 )
59  {
60  fprintf( ioQQQ," This sets the variable h, which has units 100 km/s/Mpc, and is typically 0.71\n" );
61  }
62  }
63 
64  return;
65 }
Parser::nMatch
bool nMatch(const char *chKey) const
Definition: parser.h:135
Parser::FFmtRead
double FFmtRead(void)
Definition: parser.cpp:353
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
realnum
float realnum
Definition: cddefines.h:103
t_cosmology::omega_matter
realnum omega_matter
Definition: cosmology.h:34
rfield.h
t_cosmology::omega_rad
realnum omega_rad
Definition: cosmology.h:32
t_cosmology::omega_lambda
realnum omega_lambda
Definition: cosmology.h:33
t_cosmology::omega_k
realnum omega_k
Definition: cosmology.h:35
parse.h
Parser
Definition: parser.h:31
cddefines.h
ParseCosmology
void ParseCosmology(Parser &p)
Definition: parse_cosmology.cpp:12
TotalInsanity
NORETURN void TotalInsanity(void)
Definition: service.cpp:886
radius.h
t_cosmology::lgDo
bool lgDo
Definition: cosmology.h:44
cosmology
t_cosmology cosmology
Definition: cosmology.cpp:11
cosmology.h
parser.h
physconst.h
fixit
void fixit(void)
Definition: service.cpp:991
t_cosmology::omega_baryon
realnum omega_baryon
Definition: cosmology.h:31
t_cosmology::h
realnum h
Definition: cosmology.h:38
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684