cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_norm.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 /*ParseNorm parse parameters on the normalize command */
4 #include "cddefines.h"
5 #include "lines.h"
6 #include "input.h"
7 #include "parse.h"
8 #include "lines_service.h"
9 
10 void ParseNorm(char *chCard)
11 {
12  bool lgEOL;
13  long int i;
15 
16  DEBUG_ENTRY( "ParseNorm()" );
17 
18  /* these are flags saying that normalization line has been set */
19  LineSave.lgNormSet = true;
20 
21  /* >>chng 01 aug 23, insist on a line label */
22  /*
23  * get possible label - must do first since it can contain a number.*/
24  /* is there a double quote on the line? if so then this is a line label */
25  if( strchr( chCard , '\"' ) != NULL )
26  {
27 
28  /* GetQuote does the following -
29  * first copy original version of name into chLabel,
30  * string does include null termination.
31  * set label in OrgCard and second parameter to spaces so
32  * that not picked up below as keyword */
33  GetQuote( chLabel , chCard , true );
34  if( chLabel[4] !=0 )
35  {
36  fprintf( ioQQQ, " The label identifying the line on the normalize command must be exactly 4 char long.\n" );
37  fprintf( ioQQQ, " The command line was as follows:\n %s\n", input.chCardSav[input.nRead] );
38  fprintf( ioQQQ, " The label I found was: \"%s\", where were not 4 characters between the quotes.\n", chLabel );
39  fprintf( ioQQQ, "Sorry.\n" );
40  cdEXIT(EXIT_FAILURE);
41  }
42 
43  /* copy first four char of label into caps, and null terminate*/
44  cap4( LineSave.chNormLab, chLabel);
45  }
46  else
47  {
48  fprintf( ioQQQ, "The normalize command does not have a valid line.\n" );
49  fprintf( ioQQQ, "A 4 char long line label must also be specified, between double quotes, like \"H 1\" 4861.\n" );
50  fprintf( ioQQQ, "Sorry.\n" );
51  cdEXIT(EXIT_FAILURE);
52  }
53 
54  /* normalise lines to this rather than h-b, sec number is scale factor */
55  i = 5;
56  LineSave.WavLNorm = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
57  if( lgEOL )
58  {
59  NoNumb(chCard);
60  }
61  else if( LineSave.WavLNorm < 0 )
62  {
63  fprintf( ioQQQ, "A negative wavelength does not make sense to me.\n" );
64  fprintf( ioQQQ, "Sorry.\n" );
65  cdEXIT(EXIT_FAILURE);
66  }
67 
68  /* now find out what the units of the wavelength were - options are
69  * microns, cm, default is Angstroms */
70  if( input.chCARDCAPS[i-1] == 'M' )
71  {
72  /* microns */
73  LineSave.WavLNorm *= 1e4f;
74  }
75  else if( input.chCARDCAPS[i-1] == 'C' )
76  {
77  /* centimeters */
78  LineSave.WavLNorm *= 1e8f;
79  }
80 
81  /* get the error assocated with the 4 significant figures that are visible,
82  * wavelength of 0 (a continuum) has error of zero */
84 
86 
87  if( lgEOL )
89 
90  /* confirm that scale factor is positive */
91  if( LineSave.ScaleNormLine <= 0. )
92  {
93  fprintf( ioQQQ, " The scale factor for relative intensities must be greater than zero.\n" );
94  fprintf( ioQQQ, "Sorry.\n" );
95  cdEXIT(EXIT_FAILURE);
96  }
97  return;
98 }

Generated for cloudy by doxygen 1.8.1.1