/home66/gary/public_html/cloudy/c13_branch/source/service.cpp File Reference

#include "cdstd.h"
#include <cstdarg>
#include "cddefines.h"
#include "physconst.h"
#include "cddrive.h"
#include "called.h"
#include "opacity.h"
#include "rfield.h"
#include "hextra.h"
#include "struc.h"
#include "hmi.h"
#include "fudgec.h"
#include "broke.h"
#include "trace.h"
#include "input.h"
#include "save.h"
#include "version.h"
#include "warnings.h"
#include "conv.h"
#include "thirdparty.h"
#include "mole.h"
Include dependency graph for service.cpp:

Go to the source code of this file.

Functions

char * read_whole_line (char *chLine, int nChar, FILE *ioIN)
void Split (const string &str, const string &sep, vector< string > &lst, split_mode mode)
void MyAssert (const char *file, int line, const char *comment)
double AnuUnit (realnum energy_ryd)
void ShowMe (void)
void cap4 (char *chCAP, const char *chLab)
void uncaps (char *chCard)
void caps (char *chCard)
double e2 (double t)
double ee1 (double x)
double ee1_safe (double x)
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)
int GetQuote (char *chStringOut, char *chCard, char *chCardRaw, bool lgAbort)
double powi (double x, long int n)
long ipow (long m, long n)
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)
sys_float sexp (sys_float x)
double sexp (double x)
double dsexp (double x)
void TestCode (void)
void broken (void)
void fixit (void)
void CodeReview (void)
int dprintf (FILE *fp, const char *format,...)
int dbg_printf (int debug, const char *fmt,...)
double qg32 (double xl, double xu, double(*fct)(double))
void spsort (realnum 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 ( realnum  energy  ) 

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

Definition at line 172 of file service.cpp.

References t_save::chConPunEnr, DEBUG_ENTRY, t_save::ipConPun, and save.

Referenced by AGN_Hemis(), Save1Line(), Save1LineData(), save_opacity(), SaveDo(), SaveNewContinuum(), and SaveSpeciesOne().

NORETURN void BadRead ( void   ) 

BadRead tried to read internal data and failed

Definition at line 900 of file service.cpp.

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

Referenced by diatomics::H2_Read_hminus_distribution(), 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 981 of file service.cpp.

References broke, DEBUG_ENTRY, and t_broke::lgBroke.

Referenced by fill_array(), and PresTotCurrent().

void cap4 ( char *  chCAP,
const 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 239 of file service.cpp.

References DEBUG_ENTRY, and toupper().

Referenced by cdEmis(), cdLine(), lgCheckMonitors(), optimize_func(), ParseNorm(), and PrtFinal().

Here is the call graph for this function:

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 279 of file service.cpp.

References DEBUG_ENTRY, and toupper().

Referenced by cdColm(), cdEmis(), cdIonFrac(), cdRead(), cdTemp(), t_input::echo(), Parser::newlineProcess(), and PrtFinal().

Here is the call graph for this function:

void CodeReview ( void   ) 

CodeReview - placed next to code that needs to be checked

Definition at line 999 of file service.cpp.

References broke, DEBUG_ENTRY, 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 1601 of file service.cpp.

References DEBUG_ENTRY, opac, and t_opac::OpacStack.

Referenced by OpacityAddTotal().

int 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 1030 of file service.cpp.

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

int dprintf ( FILE *  fp,
const char *  format,
  ... 
)

dprintf -- version of fprintf which prepends DEBUG

Definition at line 1008 of file service.cpp.

References DEBUG_ENTRY.

Referenced by atmdat_readin(), CoolCarb(), CoolNitr(), CoolOxyg(), CoolSili(), CoolSulf(), DumpCoolStack(), DumpHeatStack(), iso_radiative_recomb_effective(), iter_track::print_status(), and qheat_init().

double dsexp ( double  x  ) 

dsexp safe exponential function for doubles

Parameters:
x 

Definition at line 952 of file service.cpp.

References DEBUG_ENTRY, and DSEXP_LIMIT.

Referenced by atom_levelN(), dBase_solve(), FastVoigtH(), FeIICollRatesBoltzmann(), Hion_coll_ioniz_ratecoef(), hydro_vs_ioniz(), iso_collide(), iso_satellite_update(), and mole_partition_function().

double e2 ( double  t  ) 

e2 second exponential integral

Parameters:
t optical depth argument

Definition at line 298 of file service.cpp.

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

Referenced by DrvCaseBHS(), humlik(), IterRestart(), IterStart(), MakeHCTData(), newton_step(), my_Integrand_escConE2::operator()(), ParseDrive(), RT_continuum(), 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 311 of file service.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, and ioQQQ.

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

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 355 of file service.cpp.

References ASSERT, and DEBUG_ENTRY.

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 380 of file service.cpp.

References ASSERT, DEBUG_ENTRY, ioQQQ, and min().

Referenced by atmdat_LAMDA_readin(), atmdat_readin(), atmdat_STOUT_readin(), Badnell_rec_init(), ContBandsCreate(), database_readin(), dgaunt(), DrvCaseBHS(), DrvEscP(), DrvHyas(), FeIIBandsCreate(), FillGFF(), diatomics::GetIndices(), GetStandardHeLines(), diatomics::H2_Read_hminus_distribution(), diatomics::H2_ReadDissocEnergies(), diatomics::H2_ReadDissprob(), diatomics::H2_ReadEnergies(), diatomics::H2_ReadTransprob(), HeCollidSetup(), HelikeTransProbSetup(), HyperfineCreate(), iso_recomb_setup(), FunctLAMDA::operator()(), ParseDrive(), ptrcer(), read_continuum_mesh(), read_Helike_cross_sections(), read_hm05(), read_SH98_He1_cross_sections(), ReadCollisionRateTable(), and ReadIsotopeFractions().

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 990 of file service.cpp.

References broke, DEBUG_ENTRY, and t_broke::lgFixit.

Referenced by AbundChange(), atmdat_CHIANTI_readin(), atmdat_readin(), atom_oi_calc(), ChargTranSumHeat(), ContCreatePointers(), ConvBase(), CoolEvaluate(), create_isotopologues_one(), database_readin(), diatomics::diatomics(), DynaCreateArrays(), FndLineHt(), ForbiddenAuls(), GetAveVelocity(), GetDensity(), gridXspec(), diatomics::H2_CollidRateEvalAll(), diatomics::H2_LevelPops(), diatomics::H2_X_sink_and_source(), HeatSum(), HomogeneousSource(), diatomics::init(), IonCSInterp(), IonHydro(), iso_collide(), iso_cool(), iso_ionize_recombine(), iso_level(), iso_satellite(), lgNetEdenSrcSmall(), lines(), lines_helium(), lines_hydro(), t_mole_global::make_species(), mole_check_reverse_reactions(), mole_create_react(), mole_generate_isotopologue_reactions(), diatomics::mole_H2_form(), mole_h2_grain_form(), mole_h_reactions(), mole_partition_function(), mole_solve(), OpacityAddTotal(), OpacityCreateAll(), ParseAtomH2(), ParseCosmology(), ParseDont(), pressureZone(), PresTotCurrent(), PrtZone(), punchFITS_PrimaryHeader(), radius_next(), read_data(), ReadIsotopeFractions(), RT_iso_integrate_RRC(), RT_line_all(), RT_line_escape(), RT_line_one_tauinc(), RT_OTS_Update(), RT_tau_init(), SaveNewContinuum(), set_fractionation(), SetDeuteriumIonization(), diatomics::SolveExcitedElectronicLevels(), state_get_put(), states_nelemfill(), store_new_densities(), zero(), and zoneDensity().

double fudge ( long int  ipnt  ) 

fudge enter fudge factors, or some arbitrary number, with fudge command return value is the fudge factor fudge(-1) queries the routine for the number of fudge parameters that were entered, zero returned if none

Parameters:
ipnt integer saying which of the possible numbers on the fudge command to use - 0 would be the first

Definition at line 480 of file service.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, t_fudgec::fudgea, fudgec, ioQQQ, t_fudgec::lgFudgeUsed, and t_fudgec::nfudge.

Referenced by atmdat_readin(), GrainChargeTemp(), InitEmissivities(), and PresTotCurrent().

int GetQuote ( char *  chLabel,
char *  chCard,
char *  chCardRaw,
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 null terminated string between quotes
*chCard input line, imagae, we set string between quotes to spaces
lgABORT if true then abort if no double quotes found, if false then return null string in this case,
Returns:
0 if found double quotes, 1 if did not, string between quotes set to spaces

Definition at line 512 of file service.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, ioQQQ, strchr_s(), and TotalInsanity().

Referenced by cdRead().

Here is the call graph for this function:

long ipow ( long  ,
long   
)

ipow

Returns:
m^n

Definition at line 638 of file service.cpp.

References DEBUG_ENTRY, and is_odd().

Here is the call graph for this function:

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

MyAssert a version of assert that fails gracefully

Parameters:
*file 
line 

Definition at line 152 of file service.cpp.

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

Referenced by cdMain().

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 1532 of file service.cpp.

References ASSERT, cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, and ioQQQ.

double MyGaussRand ( double  PctUncertainty  ) 

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

Parameters:
PctUncertainty 

Definition at line 1682 of file service.cpp.

References ASSERT, DEBUG_ENTRY, and RandGauss().

Referenced by iso_error_generation().

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 1447 of file service.cpp.

References ASSERT, cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, ioQQQ, t_struc::nzlim, set_NaN(), and struc.

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 1568 of file service.cpp.

References ASSERT, cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, and ioQQQ.

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

nMatch determine whether match to a keyword occurs on command line, return value is 0 if no match, and position of match within string if hit

Parameters:
*chKey 
*chCard 

Definition at line 450 of file service.cpp.

References ASSERT, DEBUG_ENTRY, and strstr_s().

Referenced by atmdat_CHIANTI_readin(), atmdat_LAMDA_readin(), atmdat_STOUT_readin(), Badnell_rec_init(), cdRead(), t_input::echo(), mie_read_mix(), mie_read_rfi(), mie_read_szd(), ParseGrain(), ParseSave(), PrtFinal(), SaveDo(), StandardEnergyUnit(), StandardFluxUnit(), and vary_input().

Here is the call graph for this function:

double plankf ( long int  ip  ) 

plankf evaluate Planck function for any cell at current electron temperature

Parameters:
ip 

Definition at line 1706 of file service.cpp.

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

Referenced by SaveDo().

double powi ( double  ,
long  int 
)
void PrintE71 ( FILE *  ,
double   
)

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

Definition at line 787 of file service.cpp.

References DEBUG_ENTRY, and pow().

Referenced by PrtFinal().

Here is the call graph for this function:

void PrintE82 ( FILE *  ,
double   
)

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

Definition at line 738 of file service.cpp.

References DEBUG_ENTRY, and pow().

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

Here is the call graph for this function:

void PrintE93 ( FILE *  ,
double   
)

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

Definition at line 837 of file service.cpp.

References DEBUG_ENTRY, and pow().

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

Here is the call graph for this function:

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 1052 of file service.cpp.

References DEBUG_ENTRY.

Referenced by AngerJ(), cont_gaunt_calc(), CS_ThermAve_PR78(), iso_radrecomb_from_cross_section(), Recomb_Seaton59(), and SanityCheckBegin().

double RandGauss ( double  xMean,
double  s 
)

normal random variate generator

Parameters:
xMean mean value
s standard deviation s

Definition at line 1642 of file service.cpp.

References BIGDOUBLE, DEBUG_ENTRY, genrand_real3(), x1, and x2.

Referenced by Badnell_rec_init(), diatomics::init(), and MyGaussRand().

Here is the call graph for this function:

char* read_whole_line ( char *  chLine,
int  nChar,
FILE *  ioIN 
)
double sexp ( double  x  ) 

Definition at line 932 of file service.cpp.

References DEBUG_ENTRY, and SEXP_LIMIT.

sys_float sexp ( sys_float  x  ) 
void ShowMe ( void   ) 
void Split ( const string &  str,
const string &  sep,
vector< string > &  lst,
split_mode  mode 
)

Split: split a string into substrings using "sep" as separator

Definition at line 105 of file service.cpp.

References cdEXIT, DEBUG_ENTRY, EXIT_FAILURE, ioQQQ, SPM_KEEP_EMPTY, and SPM_STRICT.

Referenced by t_cpu_i::t_cpu_i(), and t_version::t_version().

void spsort ( realnum  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 1099 of file service.cpp.

References DEBUG_ENTRY.

Referenced by atmdat_CHIANTI_readin(), CoolSave(), diatomics::H2_PunchDo(), PrtFinal(), PrtLinePres(), SanityCheckBegin(), and SaveHeat().

void TestCode ( void   ) 

TestCode set flag saying that test code is in place

Definition at line 971 of file service.cpp.

References DEBUG_ENTRY, and lgTestCodeCalled.

Referenced by RT_continuum().

NORETURN void TotalInsanity ( void   ) 

TotalInsanity general error handler for something that cannot happen, exits

Definition at line 885 of file service.cpp.

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

Referenced by AbundancesPrt(), multi_arr< realnum, 6 >::alloc(), atmdat_CHIANTI_readin(), atmdat_LAMDA_readin(), atmdat_readin(), atom_level3(), atom_levelN(), AtomCSInterp(), Badnell_rec_init(), cdInit(), cdLine(), cdMain(), cdRead(), CHIANTI_Upsilon(), t_ADfA::coll_ion_wrapper(), collision_strength_VF01(), conorm(), ContSetIntensity(), ConvInitSolution(), ConvIterCheck(), ConvTempEdenIoniz(), CoolCarb(), CoolEvaluate(), CoolNitr(), CoolOxyg(), CoolSave(), CoolSili(), CoolSulf(), cross_section(), CS_PercivalRichards78(), database_readin(), dawson(), dBase_solve(), DebyeDeriv(), DynaPunchTimeDep(), DynaSave(), multi_geom< d, MEM_LAYOUT_VAL >::finalize(), ForbiddenAuls(), ForcePass(), t_cpu_i::getPathList(), GetQuote(), GrainChargeTemp(), GravitationalPressure(), GridGatherInCloudy(), GrnStdDpth(), H21_cm_pops(), diatomics::H2_LevelPops(), he_1trans(), helike_quantum_defect(), diatomics::init(), t_yield::init_yield(), InterpolateGridCoStar(), InterpolateModel(), InterpolateRectGrid(), IonCSInterp(), irsl2ind(), iso_assign_quantum_numbers(), iso_collapsed_Aul_update(), iso_collapsed_bnl_set(), iso_collide(), iso_create(), iso_cross_section(), iso_get_total_num_levels(), iso_radrecomb_from_cross_section(), iter_end_check(), lgCheckMonitors(), lgInputComment(), lgOptimize_do(), lines(), lines_setup(), mole_effects(), mole_h_reactions(), Opacity_iso_photo_cs(), phymir_state< X, Y, NP, NSTR >::p_barrier(), phymir_state< X, Y, NP, NSTR >::p_execute_job(), multi_arr< realnum, 6 >::p_setupArray(), pah2_fun(), pah3_fun(), ParseAtomFeII(), ParseAtomISO(), ParseBlackbody(), ParseCosmology(), ParseGrain(), ParseMonitorResults(), ParseSave(), ParseSet(), ParseTable(), PrtColumns(), PrtComment(), PrtFinal(), PrtMeanIon(), radius_first(), radius_next(), read_hm05(), read_SH98_He1_cross_sections(), ReadBadnellAIData(), rfield_opac_malloc(), RT_continuum(), RT_continuum_shield_fcn(), RT_OTS_ChkSum(), save_average(), SaveDo(), sprt_wl(), StarburstInitialize(), state_get_put(), states_nelemfill(), SumDensities(), tbl_fun(), tfidle(), timestep_next(), TlustyInterpolate(), TotalInsanityAsStub(), vary_input(), zoneDensity(), and ZoneStart().

Here is the call graph for this function:

void uncaps ( char *  chCard  ) 

uncaps convert input command line (through eol) to all lowercase

Parameters:
chCard - line image as string of characters

Definition at line 262 of file service.cpp.

References DEBUG_ENTRY, and tolower().

Referenced by atmdat_CHIANTI_readin(), atmdat_STOUT_readin(), and database_readin().

Here is the call graph for this function:

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 15 Nov 2012 for cloudy by  doxygen 1.6.1