cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_rangeoption.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2008 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 "parse.h"
8 
10  /* the number of continuum luminosity sources entered, on the c scale */
11  long int nqh,
12  /* the input line image */
13  char *chCard)
14 {
15  bool lgEOL;
16  long int i;
17  double p1,
18  p2;
19 
20  DEBUG_ENTRY( "ParseRangeOption()" );
21 
22  if( nMatch("TOTA",chCard) )
23  {
24  rfield.range[nqh][0] = rfield.emm;
25  rfield.range[nqh][1] = rfield.egamry;
26  }
27  else if( nMatch("RANG",chCard) )
28  {
29  i = 1;
30  /* first call return the luminosity on the card, ignore it */
31  p1 = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
32 
33  /* this should be the lower limit */
34  p1 = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
35  if( p1 == 0. )
36  p1 = rfield.emm;
37 
38  p2 = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
39  /* no third numer on card then go all the way to gamma ray */
40  if( p2 == 0. )
41  p2 = rfield.egamry;
42 
43  /* option to enter log if first energy is neg */
44  if( p1 < 0. || nMatch(" LOG",chCard) )
45  {
46  p1 = pow(10.,p1);
47  /* second number may not have been entered */
48  if( !lgEOL )
49  p2 = pow(10.,p2);
50  }
51 
52  /* make sure that energies are within array bounds */
53  rfield.range[nqh][0] = MAX2((realnum)p1,rfield.emm);
54  rfield.range[nqh][1] = MIN2((realnum)p2,rfield.egamry);
55  if( rfield.range[nqh][0] > rfield.range[nqh][1] )
56  {
57  fprintf( ioQQQ, " Range MUST be in increasing order - sorry.\n" );
58  cdEXIT(EXIT_FAILURE);
59  }
60  }
61  else
62  {
63  /* range not specified, use default - total ionizing field
64  * >>chng 96 dec 18, from 1.001 to 1 Ryd for H mass nuc */
65  rfield.range[nqh][0] = HIONPOT;
66  rfield.range[nqh][1] = rfield.egamry;
67  }
68  return;
69 }

Generated for cloudy by doxygen 1.8.1.2