service.cpp File Reference

#include <ctype.h>
#include <stdarg.h>
#include "cddefines.h"
#include "physconst.h"
#include "cddrive.h"
#include "opacity.h"
#include "rfield.h"
#include "hextra.h"
#include "hmi.h"
#include "fudgec.h"
#include "broke.h"
#include "trace.h"
#include "path.h"
#include "input.h"
#include "elementnames.h"
#include "punch.h"
#include "version.h"
#include "warnings.h"
#include "conv.h"

Include dependency graph for service.cpp:

Go to the source code of this file.

Functions

NORETURN void MyAssert (const char *file, int line)
void path_not_set (void)
double AnuUnit (float energy_ryd)
void ShowMe (void)
void cap4 (char *chCAP, char *chLab)
void caps (char *chCard)
double e2 (double t)
double ee1 (double x)
double ee1_safe (double x)
static void nxtchr (char *chr, long int *ichr, long int ipnt, const char *chCard, long int last, bool *lgEOL)
double FFmtRead (const char *chCard, long int *ipnt, long int last, bool *lgEOL)
long nMatch (const char *chKey, const char *chCard)
double fudge (long int ipnt)
long int GetElem (char *chCARD_CAPS)
int GetQuote (char *chLabel, char *chCard, bool lgABORT)
double powi (double x, long int n)
long ipow (long m, long n)
char * PrintEfmt (const char *fmt, double val)
void PrintE82 (FILE *ioOUT, double value)
void PrintE71 (FILE *ioOUT, double value)
void PrintE93 (FILE *ioOUT, double value)
NORETURN void TotalInsanity (void)
NORETURN void BadRead (void)
NORETURN void BadOpen (void)
NORETURN void NoNumb (char *chCard)
double sexp (double x)
double dsexp (double x)
void TestCode (void)
void broken (void)
void fixit (void)
void CodeReview (void)
void dbg_printf (int debug, const char *fmt,...)
double qg32 (double xl, double xu, double(*fct)(double))
void spsort (float x[], long int n, long int iperm[], int kflag, int *ier)
void * MyMalloc (size_t size, const char *chFile, int line)
void * MyCalloc (size_t num, size_t size)
void * MyRealloc (void *p, size_t size)
double csphot (long int inu, long int ithr, long int iofset)
double RandGauss (double xMean, double s)
double MyGaussRand (double PctUncertainty)
double plankf (long int ip)


Function Documentation

double AnuUnit ( float  energy  ) 

AnuUnit produce continuum energy in arbitrary units, ip is on C scale

Definition at line 123 of file service.cpp.

References cdEXIT(), t_punch::chConPunEnr, DEBUG_ENTRY, DEBUG_EXIT, EVRYD, ioQQQ, t_punch::ipConPun, punch, RYD_INF, RYDLAM, and SPEEDLIGHT.

Referenced by AGN_Hemis(), pun1Line(), punch_opacity(), PunchDo(), and PunchNewContinuum().

Here is the call graph for this function:

NORETURN void BadOpen ( void   ) 

BadOpen tried to open data files and failed

Definition at line 1169 of file service.cpp.

References cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, ioQQQ, and ShowMe().

Referenced by main().

Here is the call graph for this function:

NORETURN void BadRead ( void   ) 

BadRead tried to read internal data and failed

Definition at line 1151 of file service.cpp.

References cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, ioQQQ, and ShowMe().

Referenced by H2_Read_hminus_distribution(), H2_ReadCollRates(), H2_ReadDissprob(), H2_ReadEnergies(), H2_ReadTransprob(), and HelikeTransProbSetup().

Here is the call graph for this function:

void broken ( void   ) 

broken set flag saying that the code is broken

Definition at line 1263 of file service.cpp.

References broke, and t_broke::lgBroke.

Referenced by ion_solver(), and IonNitro().

void cap4 ( char *  chCAP,
char *  chLab 
)

cap4 convert first 4 char of input line chLab into chCAP all in caps, null termination

Parameters:
chCAP output string, cap'd first 4 char of chLab,
chLab with null terminating input string ending with eol

Definition at line 251 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by cdDLine(), cdEmis(), cdLine(), GetOptColDen(), IterStart(), lgCheckAsserts(), optimize_func(), ParseDLaw(), ParseElement(), ParseInterp(), ParseNorm(), ParseStop(), ParseTLaw(), and PrtFinal().

void caps ( char *  chCard  ) 

caps convert input command line (through eol) to ALL CAPS

Parameters:
chCard - line image as string of characters

Definition at line 278 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by cdColm(), cdEmis(), cdIonFrac(), cdRead(), cdTemp(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), input_readarray(), ParseAbundances(), ParseCommands(), ParseDynaTime(), ParseElement(), ParseInterp(), PrtFinal(), PrtLineSum(), punch_average(), punch_colden(), punch_line(), Punch_Line_RT(), and punResults().

void CodeReview ( void   ) 

CodeReview - placed next to code that needs to be checked

Definition at line 1281 of file service.cpp.

References broke, and t_broke::lgCheckit.

double csphot ( long int  inu,
long int  ithr,
long int  iofset 
)

csphot returns photoionization cross section from opacity stage using std pointers

Parameters:
inu INU is array index pointing to frequency where opacity is to be evaluated on f not c scale
ithr ITHR is pointer to threshold
iofset IOFSET is offset as defined in opac0

Definition at line 1921 of file service.cpp.

References DEBUG_ENTRY, DEBUG_EXIT, opac, and t_opac::OpacStack.

Referenced by OpacityAddTotal().

void dbg_printf ( int  debug,
const char *  fmt,
  ... 
)

dbg_printf is a debug print routine that was provided by Peter Teuben, as a component from his NEMO package. It offers run-time specification of the level of debugging

Definition at line 1292 of file service.cpp.

References DEBUG_ENTRY, DEBUG_EXIT, t_trace::debug_level, ioQQQ, and trace.

double dsexp ( double  x  ) 

dsexp safe exponential function for doubles

Parameters:
x 

Definition at line 1227 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by FeIICollRatesBoltzmann(), HeCollid(), Hion_coll_ioniz_ratecoef(), Hion_colldeexc_cs(), and lines_helium().

double e2 ( double  t  ) 

e2 second exponential integral

Parameters:
t optical depth argument

Definition at line 300 of file service.cpp.

References ee1(), max(), and sexp().

Referenced by DrvCaseBHS(), IterRestart(), IterStart(), MakeHCTData(), ParseDrive(), radius_increment(), RT_tau_reset(), and SanityCheckBegin().

Here is the call graph for this function:

double ee1 ( double  x  ) 

ee1 first exponential integral

Parameters:
x optical depth argument, returns e1(tau)

Definition at line 312 of file service.cpp.

References cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, and ioQQQ.

Referenced by e2(), Hion_coll_ioniz_ratecoef(), Hion_colldeexc_cs(), Hydcs123(), ParseDrive(), and SanityCheckBegin().

Here is the call graph for this function:

double ee1_safe ( double  x  ) 

this one same as ee1, except is divided by a factor of exp(x), and is only to be used for x>1.

Parameters:
x optical depth argument, returns e1(tau) * exp(x)

Definition at line 360 of file service.cpp.

References ASSERT, DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by Hion_colldeexc_cs().

double FFmtRead ( const char *  chCard,
long int *  ipnt,
long int  last,
bool *  lgEOL 
)

FFmtRead - the free-format number reader

Parameters:
*chCard string giving the line image
*ipnt the index for the character in the string where we shall start
last the number of characters in the string - do not search beyond it
*lgEOL true if hit end of line with no number

Definition at line 433 of file service.cpp.

References ASSERT, DEBUG_ENTRY, DEBUG_EXIT, expn(), and nxtchr().

Referenced by abund_starburst(), atmdat_readin(), cdGetLineList(), ContBandsCreate(), dgaunt(), DrvCaseBHS(), DrvEscP(), DrvHyas(), FeIIBandsCreate(), FillGFF(), GetOptColDen(), GetOptLineInt(), GetOptTemp(), GetStandardHeLines(), H2_ParsePunch(), H2_Read_hminus_distribution(), H2_ReadCollRates(), H2_ReadDissprob(), H2_ReadEnergies(), H2_ReadTransprob(), HeCreate(), HelikeRecombSetup(), HelikeTransProbSetup(), HyperfineCreate(), ParseAbsMag(), ParseAbundances(), ParseAge(), ParseAgn(), ParseAssertResults(), ParseAtomCO(), ParseAtomFeII(), ParseAtomH2(), ParseAtomHeLike(), ParseAtomHLike(), ParseBackgrd(), ParseBlackbody(), ParseCommands(), ParseCompile(), ParseConstant(), ParseCoronal(), ParseCosmicRays(), ParseCrashDo(), ParseDLaw(), ParseDrive(), ParseDynaTime(), ParseDynaWind(), ParseElement(), ParseF_nu(), ParseFluc(), ParseGlobule(), ParseGrain(), ParseHDEN(), ParseInterp(), ParseIonPar(), ParseMagnet(), ParseMap(), ParseMetal(), ParseNorm(), ParseOptimize(), ParsePlotRangeContin(), ParsePlotRangeOption(), ParsePowerlawContinuum(), ParsePrint(), ParsePunch(), ParseRadius(), ParseRangeOption(), ParseRatio(), ParseSet(), ParseSphere(), ParseStop(), ParseTable(), ParseTLaw(), ParseTrace(), PrtLineSum(), ptrcer(), punch_average(), punch_colden(), punch_line(), Punch_Line_RT(), read_continuum_mesh(), and read_hm05().

Here is the call graph for this function:

void fixit ( void   ) 

fixit set flag saying that this code needs attention, but is not broken, code is in service.cpp

Definition at line 1272 of file service.cpp.

References broke, and t_broke::lgFixit.

Referenced by CO_solve(), grn_abs(), hmole_step(), newreact(), and ParsePunch().

double fudge ( long int  ipnt  ) 

fudge enter fudge factors, or some arbitrary number, with fudge command

Parameters:
ipnt 

Definition at line 670 of file service.cpp.

References cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, t_fudgec::fudgea, fudgec, ioQQQ, and t_fudgec::nfudge.

Referenced by Fe7Lev8(), GrainChargeTemp(), and InitEmissivities().

Here is the call graph for this function:

long int GetElem ( char *  chCARD_CAPS  ) 

GetElem scans line image, finds element. returns atomic number j, on C scale. Returns , -1 if no hit. chCARD_CAPS must have been converted to all CAPS by caps() to work

Parameters:
chCARD_CAPS 

Definition at line 700 of file service.cpp.

References t_elementnames::chElementNameShort, DEBUG_ENTRY, DEBUG_EXIT, elementnames, LIMELM, and nMatch().

Referenced by ParseAssertResults(), ParseAtomHeLike(), ParseAtomHLike(), ParseElement(), ParsePrint(), ParsePunch(), ParseSet(), ParseTrace(), and punch_average().

Here is the call graph for this function:

int GetQuote ( char *  chLabel,
char *  chCard,
bool  lgABORT 
)

GetQuote get any name between double quotes off command line return string as chLabel, is null terminated returns zero for success, 1 for did not find double quotes

Parameters:
*chLabel we will generate a label and stuff it here
*chCard local cap'd line, we will blank this out
lgABORT if true then abort if no double quotes found, if false then return null string in this case

Definition at line 732 of file service.cpp.

References cdEXIT(), t_input::chOrgCard, DEBUG_ENTRY, DEBUG_EXIT, input, and ioQQQ.

Referenced by ParseAssertResults(), ParseCompile(), ParseGrain(), ParseInit(), ParseNorm(), ParseOptimize(), ParsePunch(), ParseSet(), ParseState(), ParseStop(), and ParseTable().

Here is the call graph for this function:

long ipow ( long  ,
long   
)

ipow

Returns:
m^n

Definition at line 875 of file service.cpp.

References DEBUG_ENTRY, DEBUG_EXIT, and is_odd().

Here is the call graph for this function:

NORETURN void MyAssert ( const char *  file,
int  line 
)

MyAssert a version of assert that fails gracefully

Parameters:
*file 
line 

Definition at line 73 of file service.cpp.

References cdEXIT(), conv, fnzone, ioQQQ, iteration, lgAssertFPE, t_conv::lgSearch, nzone, ShowMe(), TorF(), and ZeroNum.

Here is the call graph for this function:

void* MyCalloc ( size_t  num,
size_t  size 
)

MyCalloc wrapper for calloc(). Returns a good pointer or dies.

Parameters:
num use same type as library function CALLOC
size 

Definition at line 1840 of file service.cpp.

References ASSERT, cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, and ioQQQ.

Here is the call graph for this function:

double MyGaussRand ( double  PctUncertainty  ) 

A custom wrapper for RandGauss than truncates at two standard deviations.

Parameters:
PctUncertainty 

Definition at line 2012 of file service.cpp.

References ASSERT, DEBUG_ENTRY, DEBUG_EXIT, and RandGauss().

Referenced by HeLikeError().

Here is the call graph for this function:

void* MyMalloc ( size_t  size,
const char *  file,
int  line 
)

MyMalloc wrapper for malloc(). Returns a good pointer or dies.

Parameters:
size use same type as library function malloc
file 
line 

Definition at line 1755 of file service.cpp.

References ASSERT, cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, ioQQQ, set_nan(), and set_nanf().

Here is the call graph for this function:

void* MyRealloc ( void *  p,
size_t  size 
)

MyRealloc wrapper for realloc(). Returns a good pointer or dies.

Parameters:
num use same type as library function REALLOC
size 

Definition at line 1882 of file service.cpp.

References ASSERT, cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, and ioQQQ.

Here is the call graph for this function:

long nMatch ( const char *  chKey,
const char *  chCard 
)

NORETURN void NoNumb ( char *  chCard  ) 

NoNumb general error handler for no numbers on input line

Parameters:
*chCard 

Definition at line 1187 of file service.cpp.

References cdEXIT(), DEBUG_ENTRY, DEBUG_EXIT, and ioQQQ.

Referenced by ParseAssertResults(), ParseAtomFeII(), ParseAtomH2(), ParseAtomHeLike(), ParseAtomHLike(), ParseCommands(), ParseConstant(), ParseCosmicRays(), ParseDynaTime(), ParseDynaWind(), ParseF_nu(), ParseIonPar(), ParseMagnet(), ParseNorm(), ParsePunch(), ParseSet(), ParseStop(), punch_average(), and punch_colden().

Here is the call graph for this function:

static void nxtchr ( char *  chr,
long int *  ichr,
long int  ipnt,
const char *  chCard,
long int  last,
bool *  lgEOL 
) [static]

Definition at line 393 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by FFmtRead().

void path_not_set ( void   ) 

double plankf ( long int  ip  ) 

plankf evaluate Planck function for any cell at current electron temperature

Parameters:
ip 

Definition at line 2040 of file service.cpp.

References t_rfield::anu, t_rfield::ContBoltz, DEBUG_ENTRY, DEBUG_EXIT, FR1RYD, POW2, and rfield.

Referenced by PunchDo().

double powi ( double  ,
long  int 
)

void PrintE71 ( FILE *  ,
double   
)

print with 1p,e8.1 format onto stream FILE

Definition at line 1032 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by PrtFinal().

void PrintE82 ( FILE *  ,
double   
)

print with 1p,e8.2 format onto stream FILE all are located in printe82.c

Definition at line 983 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by AbundancesSet(), optimize_func(), PrtAllTau(), PrtFinal(), and PrtHeader().

void PrintE93 ( FILE *  ,
double   
)

print with 1p,e9.3 format onto stream FILE

Definition at line 1082 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by HydroLevel(), PrtAllTau(), PrtFinal(), PrtHeader(), PrtHydroTrace1a(), PrtZone(), and punch_opacity().

char* PrintEfmt ( const char *  fmt,
double  val 
)

double qg32 ( double  ,
double  ,
double(*)(double)   
)

32 point gaussian quadrature integration

Parameters:
xl lower limit to integration
xu - upper limit to integration
(*fct) - pointer to routine to be integrated, arg is x val

Definition at line 1317 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by AngerJ(), CalculateRadialIntegral(), collision_strength_VF01(), conpmp(), cont_gaunt_calc(), CS_l_mixing_S62(), CS_l_mixing_VF01(), CS_VS80(), DrvContPump(), esccon(), radrecomb(), and Recomb_Seaton59().

double RandGauss ( double  xMean,
double  s 
)

normal random variate generator

Parameters:
xMean mean value
s standard deviation s

Definition at line 1969 of file service.cpp.

References BIGDOUBLE, DEBUG_ENTRY, DEBUG_EXIT, x1, and x2.

Referenced by H2_Create(), ion_recomb(), and MyGaussRand().

double sexp ( double  x  ) 

void ShowMe ( void   ) 

void spsort ( float  x[],
long int  n,
long int  iperm[],
int  kflag,
int *  ier 
)

spsort netlib routine to sort array returning sorted indices

Parameters:
x[] input array to be sorted
n number of values in x
iperm[] permutation output array
kflag flag saying what to do - 1 sorts into increasing order, not changing
kflag the original routine
*ier error condition, should be 0

Definition at line 1386 of file service.cpp.

References DEBUG_ENTRY, and DEBUG_EXIT.

Referenced by CoolPunch(), H2_Create(), H2_PunchDo(), HeatPunch(), PrtFinal(), PrtLinePres(), and SanityCheckBegin().

void TestCode ( void   ) 

testcde set flag saying that test code is in place

Definition at line 1249 of file service.cpp.

References DEBUG_ENTRY, DEBUG_EXIT, and lgTestCodeCalled.

NORETURN void TotalInsanity ( void   ) 


Generated for cloudy by doxygen 1.5.9