cloudy
trunk
source
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
9
void
ParseRangeOption
(
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"
);
55
cdEXIT
(
EXIT_FAILURE
);
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
}
Parser::nMatch
bool nMatch(const char *chKey) const
Definition:
parser.h:135
Parser::FFmtRead
double FFmtRead(void)
Definition:
parser.cpp:353
ParseRangeOption
void ParseRangeOption(Parser &p)
Definition:
parse_rangeoption.cpp:9
rfield
t_rfield rfield
Definition:
rfield.cpp:8
ioQQQ
FILE * ioQQQ
Definition:
cddefines.cpp:7
realnum
float realnum
Definition:
cddefines.h:103
rfield.h
HIONPOT
const UNUSED double HIONPOT
Definition:
physconst.h:119
MIN2
#define MIN2
Definition:
cddefines.h:761
EXIT_FAILURE
#define EXIT_FAILURE
Definition:
cddefines.h:140
t_rfield::egamry
realnum egamry
Definition:
rfield.h:52
Parser
Definition:
parser.h:31
cddefines.h
MAX2
#define MAX2
Definition:
cddefines.h:782
cdEXIT
#define cdEXIT(FAIL)
Definition:
cddefines.h:434
Parser::lgEOL
bool lgEOL(void) const
Definition:
parser.h:98
t_rfield::range
double range[LIMSPC][2]
Definition:
rfield.h:347
parser.h
physconst.h
Parser::m_nqh
long int m_nqh
Definition:
parser.h:41
Parser::set_point
void set_point(long int ipnt)
Definition:
parser.h:77
t_rfield::emm
realnum emm
Definition:
rfield.h:49
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition:
cddefines.h:684
Generated by
1.8.17