cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
bool nMatch(const char *chKey) const
Definition: parser.h:135
realnum h
Definition: cosmology.h:38
double FFmtRead(void)
Definition: parser.cpp:353
NORETURN void TotalInsanity(void)
Definition: service.cpp:886
FILE * ioQQQ
Definition: cddefines.cpp:7
bool lgDo
Definition: cosmology.h:44
Definition: parser.h:31
void ParseCosmology(Parser &p)
float realnum
Definition: cddefines.h:107
realnum omega_baryon
Definition: cosmology.h:31
realnum omega_lambda
Definition: cosmology.h:31
realnum omega_k
Definition: cosmology.h:31
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:688
t_cosmology cosmology
Definition: cosmology.cpp:11
realnum omega_rad
Definition: cosmology.h:31
void fixit(void)
Definition: service.cpp:991
realnum omega_matter
Definition: cosmology.h:31