cloudy trunk
Loading...
Searching...
No Matches
parse_norm.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/*ParseNorm parse parameters on the normalize command */
4#include "cddefines.h"
5#include "lines.h"
6#include "input.h"
7#include "parser.h"
8#include "lines_service.h"
9
11{
12 char chLabel[INPUT_LINE_LENGTH];
13
14 DEBUG_ENTRY( "ParseNorm()" );
15
16 /* these are flags saying that normalization line has been set */
17 LineSave.lgNormSet = true;
18
19 /* >>chng 01 aug 23, insist on a line label */
20 /*
21 * get possible label - must do first since it can contain a number.*/
22 /* is there a double quote on the line? if so then this is a line label */
23 if( p.nMatch( "\"" ) )
24 {
25
26 /* GetQuote does the following -
27 * first copy original version of name into chLabel,
28 * string does include null termination.
29 * set label in OrgCard and second parameter to spaces so
30 * that not picked up below as keyword */
31 p.GetQuote( chLabel , true );
32 if( chLabel[4] != '\0' || strlen(chLabel) != 4 )
33 {
34 fprintf( ioQQQ, " The label identifying the line on the normalize command must be exactly 4 char long.\n" );
35 fprintf( ioQQQ, " The command line was as follows:\n %s\n", input.chCardSav[input.nRead] );
36 fprintf( ioQQQ, " The label I found was: \"%s\", where were not 4 characters between the quotes.\n", chLabel );
37 fprintf( ioQQQ, "Sorry.\n" );
39 }
40
41 /* copy first four char of label into caps, and null terminate*/
42 cap4( LineSave.chNormLab, chLabel);
43 }
44 else
45 {
46 fprintf( ioQQQ, "The normalize command does not have a valid line.\n" );
47 fprintf( ioQQQ, "A 4 char long line label must also be specified, between double quotes, like \"H 1\" 4861.\n" );
48 fprintf( ioQQQ, "Sorry.\n" );
50 }
51
52 /* normalise lines to this rather than h-b, sec number is scale factor */
53 LineSave.WavLNorm = (realnum)p.getWave();
54
55 if( LineSave.WavLNorm < 0 )
56 {
57 fprintf( ioQQQ, "A negative wavelength does not make sense to me.\n" );
58 fprintf( ioQQQ, "Sorry.\n" );
60 }
61
62 /* get the error assocated with the 4 significant figures that are visible,
63 * wavelength of 0 (a continuum) has error of zero */
64 LineSave.errorwave = WavlenErrorGet( LineSave.WavLNorm );
65
66 LineSave.ScaleNormLine = p.FFmtRead();
67
68 if( p.lgEOL() )
69 LineSave.ScaleNormLine = 1.;
70
71 /* confirm that scale factor is positive */
72 if( LineSave.ScaleNormLine <= 0. )
73 {
74 fprintf( ioQQQ, " The scale factor for relative intensities must be greater than zero.\n" );
75 fprintf( ioQQQ, "Sorry.\n" );
77 }
78 return;
79}
FILE * ioQQQ
Definition cddefines.cpp:7
const int INPUT_LINE_LENGTH
Definition cddefines.h:254
#define EXIT_FAILURE
Definition cddefines.h:140
void cap4(char *chCAP, const char *chLab)
Definition service.cpp:240
#define cdEXIT(FAIL)
Definition cddefines.h:434
float realnum
Definition cddefines.h:103
#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
bool lgEOL(void) const
Definition parser.h:98
double getWave()
Definition parser.cpp:260
int GetQuote(char *chLabel, bool lgABORT)
Definition parser.h:209
t_input input
Definition input.cpp:12
t_LineSave LineSave
Definition lines.cpp:5
realnum WavlenErrorGet(realnum wavelength)
void ParseNorm(Parser &p)