cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
iso_error.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2022 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*HeLikeError fills uncertainty arrays */
4 #include "cddefines.h"
5 #include "iso.h"
6 
7 /* This routine handles errors when that option is turned on (via the command
8  * "atom he-like error generation" */
9 void iso_put_error(long int ipISO,
10  long int nelem,
11  long int ipHi,
12  long int ipLo,
13  long int whichData,
14  realnum errorOpt,
15  realnum errorPess)
16 {
17 
18  DEBUG_ENTRY( "iso_put_error()" );
19 
20  if( iso_ctrl.lgRandErrGen[ipISO] )
21  {
22  /* whichData is either IPRAD, IPCOLLIS, or IPENERGY */
23  ASSERT( whichData <= 2 );
24  ASSERT( ipISO < NISO );
25  ASSERT( nelem < LIMELM );
26  ASSERT( ipHi <= iso_sp[ipISO][nelem].numLevels_max );
27  ASSERT( ipLo <= iso_sp[ipISO][nelem].numLevels_max );
28  ASSERT( errorOpt >= 0. );
29  ASSERT( errorPess >= 0. );
30 
32  iso_sp[ipISO][nelem].ex[ipHi][ipLo].Error[whichData] = errorOpt;
33  else
34  iso_sp[ipISO][nelem].ex[ipHi][ipLo].Error[whichData] = errorPess;
35  }
36  return;
37 }
38 
39 void iso_error_generation( long ipISO, long nelem )
40 {
41  long ipHi, ipLo, typeOfRate;
42 
43  DEBUG_ENTRY( "iso_error_generation()" );
44 
45  //iso_sp[ipISO][nelem].ex[iso_sp[ipISO][nelem].numLevels_max][iso_sp[ipISO][nelem].numLevels_max].ErrorFactor[IPRAD] =
46  //(realnum)MyGaussRand( iso_sp[ipISO][nelem].ex[iso_sp[ipISO][nelem].numLevels_max][iso_sp[ipISO][nelem].numLevels_max].Error[IPRAD] );
47 
48  for( ipHi=1; ipHi<= iso_sp[ipISO][nelem].numLevels_max; ipHi++ )
49  {
50  /* >>chng 06 mar 15, the upper limit incorrectly went to numLevels_max */
51  for( ipLo=0; ipLo< ipHi; ipLo++ )
52  {
53  for( typeOfRate=0; typeOfRate<=1; typeOfRate++ )
54  {
55  if( iso_sp[ipISO][nelem].ex[ipHi][ipLo].Error[typeOfRate] >= 0. )
56  {
57  iso_sp[ipISO][nelem].ex[ipHi][ipLo].ErrorFactor[typeOfRate] =
58  (realnum)MyGaussRand( iso_sp[ipISO][nelem].ex[ipHi][ipLo].Error[typeOfRate] );
59  ASSERT( iso_sp[ipISO][nelem].ex[ipHi][ipLo].ErrorFactor[typeOfRate] > 0. );
60  }
61  else
62  {
63  iso_sp[ipISO][nelem].ex[ipHi][ipLo].ErrorFactor[typeOfRate] = 1.0f;
64  }
65  }
66  }
67  }
68 
69  /* set flag saying that error generation has been done. */
70  iso_sp[ipISO][nelem].lgErrGenDone = true;
71  return;
72 }
bool lgPessimisticErrors
Definition: iso.h:433
t_isoCTRL iso_ctrl
Definition: iso.cpp:9
const int NISO
Definition: cddefines.h:311
bool lgRandErrGen[NISO]
Definition: iso.h:430
void iso_put_error(long ipISO, long nelem, long ipHi, long ipLo, long whichData, realnum errorOpt, realnum errorPess)
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:11
void iso_error_generation(long ipISO, long nelem)
Definition: iso_error.cpp:39
float realnum
Definition: cddefines.h:124
multi_arr< extra_tr, 2 > ex
Definition: iso.h:478
#define ASSERT(exp)
Definition: cddefines.h:613
const int LIMELM
Definition: cddefines.h:308
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
long int numLevels_max
Definition: iso.h:524
double MyGaussRand(double PctUncertainty)
Definition: service.cpp:1736
bool lgErrGenDone
Definition: iso.h:591