/* these headers are needed by all files */ #include #include #include #include /************************************************************************** * all prototypes defined in this file: * the following are prototypes for some routines that are part of the * debugging process - they come and go in any particular sub. * it is not necessary to declare them when used since they are defined here **************************************************************************/ /* fudge enter fudge factors, or some arbitrary number, with fudge command*/ double fudge(long int ipnt); /*broken set flag saying that the code is broken */ void broken(void); /*fixit set flag saying that this code needs attention, but is not broken, * code is in broken.c */ void fixit(void); /*TestCode set flag saying that test code is in place */ void TestCode(void); /* this routine should be called just before exit to close all open io units */ void CloseUnits(void); /************************************************************************** * these are variables and pointers for output from the code, used everywhere * thre is an empty ipqq.h file that used to contain this **************************************************************************/ /* * ioQQQ is the pointer to the output file itself, * ioQQQ is set to stdout by default in cdInit, * and is reset to anything else by calling cdOutp */ extern FILE *ioQQQ; extern FILE *ioMAP; /* we shall write errors to this file, it is set * to stderr in cdInit */ extern FILE* ioPrnErr; /* this is flag saying whether to print errors to * standard error output */ extern int lgPrnErr; /* some levels for hydrogenic species, defined in cddefines.c, * where set to 0, 1, and 2 */ extern const int IP1S; extern const int IP2S; extern const int IP2P; /* these are pointers to some elements, defined in cddefines.c */ extern const int ipH; extern const int ipHE; /************************************************************************** * * these are constants used to dimension several vectors * **************************************************************************/ /* limit to number of cells in frequency array */ #define NCELL 2000L /* * lmhlvl appears in dimension statements throughout the code, is hardwired * limit to number of levels in hydrogenic species * * since 1s is 0, 2s 1, and 2p 2, n=50 is 50, and this * requires 51 cells. * Loops should always be from 0 to <=LMHLVL, to be parallel with nhlevel, * the number of levels for this run. This means that all vectors must * be dimensioned LMHLVL+1 */ /* #define LMHLVL 50L no longer used - remove */ /* following is real limit to how many levels can be computed for * model hydrogen atom - this has the one extra included, so at most * nhlevel can be NHYDRO_MAX_LEVEL-1 and vectors should be dim NHYDRO_MAX_LEVEL*/ #define NHYDRO_MAX_LEVEL 401L /* This is the number of elements included in the code, * is used to set lengths of many vectors */ #define LIMELM 30L /* dimension of vector to do with number of iterations stored * so, this is the the most that can possibly be performed */ #define ITRDIM 20L /* safe, small, numbers for the float and double */ #define SMALLFLOAT 1e-35f #define SMALLDOUBLE 1e-300 /************************************************************************** * * disable some bogus errors in the ms c compiler * **************************************************************************/ /* */ #ifdef _MSC_VER # pragma warning( disable : 4127 )/* disable warning that conditional expression*/ /* is constant, TRUE or FALSE in if */ # pragma warning( disable : 4056 )/* disable bogus underflow warning in MS VS*/ # pragma warning( disable : 4514 )/* disable "inline function removed since not used", MS VS*/ #endif /* */ /************************************************************************** * * various macros used by the code * **************************************************************************/ /* file ptr for optional C Debug code, * entry and exit of each routine will go here, * macros enabled if compiler-set flag DEBUG_FUN is true */ #ifndef debug_fp extern FILE *debug_fp; #endif /* */ /* will be redefined as nothing in place where variables are defined */ #define EXTERN extern #ifndef TorF /* TorF(l) returns a 'T' or 'F' depending on the 'logical' expr 'l' */ #define TorF(l) ( l ? 'T' : 'F' ) #endif /* */ #ifndef MIN2 /* MIN2 takes two arguments, returns the smaller of the two */ #define MIN2(a,b) (((a)<(b)) ? (a) : (b)) #endif /* */ #ifndef MIN3 /* MIN3 takes 3 arguments, returns the smallest of the 3 */ #define MIN3(a,b,c) (MIN2(MIN2(a,b),c)) #endif /* */ #ifndef MIN4 /* MIN2 takes 4 arguments, returns the smallest of the 4 */ #define MIN4(a,b,c,d) (MIN2(MIN2(a,b),MIN2(c,d))) #endif /* */ #ifndef MAX2 /* MAX2 takes two arguments, returns the larger of the two */ #define MAX2(a,b) (((a)>(b)) ? (a) : (b)) #endif /* */ #ifndef MAX3 /* MAX3 takes 3 arguments, returns the largest of the 3 */ #define MAX3(a,b,c) (MAX2(MAX2(a,b),c)) #endif /* */ #ifndef MAX4 /* MAX2 takes 4 arguments, returns the largest of the 4 */ #define MAX4(a,b,c,d) (MAX2(MAX2(a,b),MAX2(c,d))) #endif /* */ #ifndef POW2 /* POW2 takes 1 argument, and squares it */ #define POW2(a) ((a)*(a)) #endif /* */ #ifndef POW3 /* POW3 takes 1 argument, and cubes it */ #define POW3(a) ((a)*(a)*(a)) #endif /* */ /* macro to determine size of an array - * from p 22, Practice of Programming, * by B.W. Kernighan & Rob Pike, Addison Wesley. * use: * double dbuf[100]; for( i=0; i