cloudy trunk
Loading...
Searching...
No Matches
parse_rangeoption.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/*ParseRangeOption parse the range option on the luminosity command */
4#include "cddefines.h"
5#include "physconst.h"
6#include "rfield.h"
7#include "parser.h"
8
10 /* the input line image */
11 Parser &p)
12{
13 bool lgP1Absent, lgP2Absent;
14 double p1,
15 p2;
16
17 DEBUG_ENTRY( "ParseRangeOption()" );
18
19 if( p.nMatch("TOTA") )
20 {
21 rfield.range[p.m_nqh][0] = rfield.emm;
22 rfield.range[p.m_nqh][1] = rfield.egamry;
23 }
24 else if( p.nMatch("RANG") )
25 {
26 p.set_point(0);
27 /* first call return the luminosity on the card, ignore it */
28 p1 = p.FFmtRead();
29 lgP1Absent = p.lgEOL();
30
31 /* read lower limit and upper limit*/
32 p1 = p.FFmtRead();
33 lgP1Absent = p.lgEOL();
34 p2 = p.FFmtRead();
35 lgP2Absent = p.lgEOL();
36
37 /* option to enter log if first energy is neg */
38 if( p1 < 0. || p.nMatch(" LOG") )
39 {
40 p1 = pow(10.,p1);
41 p2 = pow(10.,p2);
42 }
43
44 if( lgP1Absent )
45 p1 = rfield.emm;
46 if( lgP2Absent )
47 p2 = rfield.egamry;
48
49 /* make sure that energies are within array bounds */
50 rfield.range[p.m_nqh][0] = MAX2((realnum)p1,rfield.emm);
51 rfield.range[p.m_nqh][1] = MIN2((realnum)p2,rfield.egamry);
52 if( rfield.range[p.m_nqh][0] >= rfield.range[p.m_nqh][1] )
53 {
54 fprintf( ioQQQ, " Range MUST be in increasing order - sorry.\n" );
56 }
57 }
58 else
59 {
60 /* range not specified, use default - total ionizing field
61 * >>chng 96 dec 18, from 1.001 to 1 Ryd for H mass nuc */
62 rfield.range[p.m_nqh][0] = HIONPOT;
63 rfield.range[p.m_nqh][1] = rfield.egamry;
64 }
65 return;
66}
FILE * ioQQQ
Definition cddefines.cpp:7
#define MIN2
Definition cddefines.h:761
#define EXIT_FAILURE
Definition cddefines.h:140
#define cdEXIT(FAIL)
Definition cddefines.h:434
float realnum
Definition cddefines.h:103
#define MAX2
Definition cddefines.h:782
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
double FFmtRead(void)
Definition parser.cpp:353
bool nMatch(const char *chKey) const
Definition parser.h:135
void set_point(long int ipnt)
Definition parser.h:77
bool lgEOL(void) const
Definition parser.h:98
long int m_nqh
Definition parser.h:41
void ParseRangeOption(Parser &p)
UNUSED const double HIONPOT
Definition physconst.h:119
t_rfield rfield
Definition rfield.cpp:8