00001 /* This file is part of Cloudy and is copyright (C)1978-2010 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*ParseCosmology parse cosmological parameters and options */ 00004 #include "cddefines.h" 00005 #include "radius.h" 00006 #include "rfield.h" 00007 #include "parse.h" 00008 #include "physconst.h" 00009 #include "cosmology.h" 00010 #include "parser.h" 00011 00012 void ParseCosmology( Parser &p ) 00013 { 00014 realnum param; 00015 00016 DEBUG_ENTRY( "ParseCosmology()" ); 00017 00018 cosmology.lgDo = true; 00019 00020 /* set an omega parameter */ 00021 if( p.nMatch("OMEG") ) 00022 { 00023 param = (realnum)p.FFmtRead(); 00024 00025 if( p.nMatch( "BARY") ) 00026 { 00027 cosmology.omega_baryon = param; 00028 } 00029 else if( p.nMatch( "RADI") ) 00030 { 00031 cosmology.omega_rad = param; 00032 } 00033 else if( p.nMatch( "MATT") ) 00034 { 00035 cosmology.omega_matter = param; 00036 } 00037 else if( p.nMatch( "LAMB") ) 00038 { 00039 cosmology.omega_lambda = param; 00040 } 00041 else if( p.nMatch( " K ") || p.nMatch( "CURV") ) 00042 { 00043 cosmology.omega_k = param; 00044 } 00045 else 00046 { 00047 // must terminate clause safely 00048 fixit();// what should it do? 00049 TotalInsanity(); 00050 } 00051 } 00052 else if( p.nMatch("HUBB") ) 00053 { 00054 param = (realnum)p.FFmtRead(); 00055 00056 cosmology.h = param; 00057 00058 if( param <= 0 || param > 1.1 ) 00059 { 00060 fprintf( ioQQQ," This sets the variable h, which has units 100 km/s/Mpc, and is typically 0.71\n" ); 00061 } 00062 } 00063 00064 return; 00065 }