cloudy trunk
Loading...
Searching...
No Matches
cddefines.h
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
4#ifndef CDDEFINES_H_
5#define CDDEFINES_H_
6
7#include "cdstd.h"
8
9#ifdef _MSC_VER
10/* disable warning that conditional expression is constant, true or false in if */
11# pragma warning( disable : 4127 )
12/* we are not using MS foundation class */
13# ifndef WIN32_LEAN_AND_MEAN
14# define WIN32_LEAN_AND_MEAN
15# endif
16#endif
17
18#ifdef __clang__
19// this would generate lots of warnings about mismatched tags in the STL valarray definition
20#pragma clang diagnostic ignored "-Wmismatched-tags"
21#endif
22
23/* these headers are needed by all files */
24/*lint -e129 these resolve several issues pclint has with my system headers */
25/*lint -e78 */
26/*lint -e830 */
27/*lint -e38 */
28/*lint -e148 */
29/*lint -e114 */
30/*lint -e18 */
31/*lint -e49 */
32// C++ versions of C headers
33#include <cstdio>
34#include <cstdlib>
35#include <cctype>
36#ifdef _MSC_VER
37// MSVC needs this before cmath in order provide numeric constants
38// (M_PI etc.) defined by C99 but not C++ standards to date.
39#define _USE_MATH_DEFINES
40#endif
41#include <cmath>
42#include <cassert>
43#include <cstring>
44#include <cfloat>
45#include <climits>
46#include <ctime>
47#if defined(__sun) && defined(__SUNPRO_CC)
48// with Solaris Studio 12.2 under Sparc Solaris, csignal doesn't define sigaction...
49#include <signal.h>
50#else
51#include <csignal>
52#endif
53// C++ headers
54#include <limits>
55#include <string>
56#include <sstream>
57#include <iomanip>
58#include <vector>
59#include <valarray>
60#include <complex>
61#include <map>
62#include <memory>
63#include <stdexcept>
64#include <algorithm>
65#include <fstream>
66#include <bitset>
67#ifdef DMALLOC
68#include <dmalloc.h>
69#endif
70
71// Workaround for Windows...
72#if defined(_MSC_VER) && !defined(SYS_CONFIG)
73#define SYS_CONFIG "cloudyconfig_vs.h"
74#endif
75
76// platform specific configuration; generated by configure.sh
77#ifdef SYS_CONFIG
78#include SYS_CONFIG
79#else
80#include "cloudyconfig.h"
81#endif
82
83/*lint +e18 */
84/*lint +e49 */
85/*lint +e38 */
86/*lint +e148 */
87/*lint +e830 */
88/*lint +e78 */
89/*lint -e129 */
90
91using namespace std;
92
93#undef STATIC
94#ifdef USE_GPROF
95#define STATIC
96#else
97#define STATIC static
98#endif
99
100#ifdef FLT_IS_DBL
101typedef double realnum;
102#else
103typedef float realnum;
104#endif
105
106typedef float sys_float;
107// prevent explicit float's from creeping back into the code
108#define float PLEASE_USE_REALNUM_NOT_FLOAT
109
110//Compile-time assertion after Alexandrescu
111template<bool> struct StaticAssertFailed;
112template<> struct StaticAssertFailed<true> {};
113#define STATIC_ASSERT(x) ((void)StaticAssertFailed< (x) == true >())
114
115typedef enum {
116 ES_SUCCESS=0, // everything went fine...
117 ES_FAILURE=1, // general failure exit
118 ES_WARNINGS, // warnings were present
119 ES_BOTCHES, // botched monitors were present
120 ES_CLOUDY_ABORT, // Cloudy aborted
121 ES_BAD_ASSERT, // an assert in the code failed
122 ES_BAD_ALLOC, // a memory allocation failed
123 ES_OUT_OF_RANGE, // an out-of-range exception was thrown
124 ES_USER_INTERRUPT, // the user terminated Cloudy (with ^C)
125 ES_TERMINATION_REQUEST, // Cloudy received a termination request
126 ES_ILLEGAL_INSTRUCTION, // the CPU encountered an illegal instruction
127 ES_FP_EXCEPTION, // a floating point exception was caught
128 ES_SEGFAULT, // a segmentation fault occurred
129 ES_BUS_ERROR, // a bus error occurred
130 ES_UNKNOWN_SIGNAL, // an unknown signal was caught
131 ES_UNKNOWN_EXCEPTION, // an unknown exception was caught
132 ES_TOP // NB NB -- this should always be the last entry
133} exit_type;
134
135// make sure the system definitions are on par with ours
136// especially EXIT_FAILURE does not have a guaranteed value!
137#undef EXIT_SUCCESS
138#define EXIT_SUCCESS ES_SUCCESS
139#undef EXIT_FAILURE
140#define EXIT_FAILURE ES_FAILURE
141
142/* make sure this is globally visible as well! */
143/* This must be done at the start of every file, to ensure that policy
144 for FPE handling, etc., is guaranteed to be set up before the
145 construction of file-statics and globals. */
146#include "cpu.h"
147
148//*************************************************************************
149//
167//
168// This implementation has been obtained from Wikipedia
169//
170//*************************************************************************
171
172template<typename T> class Singleton
173{
174public:
175 static T& Inst()
176 {
177 static T instance; // assumes T has a protected default constructor
178 return instance;
179 }
180};
181
182/**************************************************************************
183 *
184 * these are variables and pointers for output from the code, used everywhere
185 * declared extern here, and definition is in cddefines.cpp
186 *
187 **************************************************************************/
188
192extern FILE *ioQQQ;
193
194extern FILE *ioStdin;
195
196extern FILE *ioMAP;
197
200extern FILE* ioPrnErr;
201
203extern bool lgAbort;
204
207extern bool lgTestCodeCalled;
208
211extern bool lgTestCodeEnabled;
212
215extern bool lgPrnErr;
216
219extern long int nzone;
220
222extern double fnzone;
223
226extern long int iteration;
227
234extern const double ZeroNum;
235
236/**************************************************************************
237 *
238 * these are constants used to dimension several vectors and index arrays
239 *
240 **************************************************************************/
241
246const int FILENAME_PATH_LENGTH = 200;
247
250
254const int INPUT_LINE_LENGTH = 2000;
255
258const int LIMELM = 30;
259
261const int NISO = 2;
262
266const int NHYDRO_MAX_LEVEL = 401;
267
269const double MAX_DENSITY = 1.e24;
270
272const double DEPTH_OFFSET = 1.e-30;
273
276
277/* indices within recombination coefficient array */
278/* ipRecEsc is state specific escape probability*/
279const int ipRecEsc = 2;
280/* the net escaping, including destruction by background and optical deepth*/
281const int ipRecNetEsc = 1;
282/* ipRecRad is state specific radiative recombination rate*/
283const int ipRecRad = 0;
287
288/* these specify the form of the line redistribution function */
289/* partial redistribution with wings */
290const int ipPRD = 1;
291/* complete redistribution, core only, no wings, Hummer's K2 function */
292const int ipCRD = -1;
293/* complete redistribution with wings */
294const int ipCRDW = 2;
295/* redistribution function for Lya, calls Hummer routine for H-like series only */
296const int ipLY_A = -2;
297/* core function for K2 destruction */
298const int ipDEST_K2 = 1;
299/* core function for complete redist destruction */
300const int ipDEST_INCOM = 2;
301/* core function for simple destruction */
302const int ipDEST_SIMPL = 3;
303
305const int ipHYDROGEN = 0;
306const int ipHELIUM = 1;
307const int ipLITHIUM = 2;
308const int ipBERYLLIUM = 3;
309const int ipBORON = 4;
310const int ipCARBON = 5;
311const int ipNITROGEN = 6;
312const int ipOXYGEN = 7;
313const int ipFLUORINE = 8;
314const int ipNEON = 9;
315const int ipSODIUM = 10;
316const int ipMAGNESIUM = 11;
317const int ipALUMINIUM = 12;
318const int ipSILICON = 13;
319const int ipPHOSPHORUS = 14;
320const int ipSULPHUR = 15;
321const int ipCHLORINE = 16;
322const int ipARGON = 17;
323const int ipPOTASSIUM = 18;
324const int ipCALCIUM = 19;
325const int ipSCANDIUM = 20;
326const int ipTITANIUM = 21;
327const int ipVANADIUM = 22;
328const int ipCHROMIUM = 23;
329const int ipMANGANESE = 24;
330const int ipIRON = 25;
331const int ipCOBALT = 26;
332const int ipNICKEL = 27;
333const int ipCOPPER = 28;
334const int ipZINC = 29;
335const int ipKRYPTON = 35;
336
337/***************************************************************************
338 * the following are prototypes for some routines that are part of the
339 * debugging process - they come and go in any particular sub.
340 * it is not necessary to declare them when used since they are defined here
341 **************************************************************************/
342
351double fudge(long int ipnt);
352
356void broken(void);
357
360void fixit(void);
361
363void CodeReview(void);
364
366void TestCode(void);
367
373void *MyMalloc(size_t size, const char *file, int line);
374
379void *MyCalloc(size_t num, size_t size);
380
385void *MyRealloc(void *p, size_t size);
386
391void MyAssert(const char *file, int line, const char *comment);
392
395
397{
398 const char* p_routine;
399 const char* p_file;
400 long p_line;
402public:
403 cloudy_exit(const char* routine, const char* file, long line, exit_type exit_code)
404 {
406 p_file = file;
407 p_line = line;
408 p_exit = exit_code;
409 }
410 virtual ~cloudy_exit() throw()
411 {
412 p_routine = NULL;
413 p_file = NULL;
414 }
415 const char* routine() const throw()
416 {
417 return p_routine;
418 }
419 const char* file() const throw()
420 {
421 return p_file;
422 }
423 long line() const
424 {
425 return p_line;
426 }
428 {
429 return p_exit;
430 }
431};
432
433// workarounds for __func__ are defined in cpu.h
434#define cdEXIT( FAIL ) throw cloudy_exit( __func__, __FILE__, __LINE__, FAIL )
435
436// calls like puts( "[Stop in MyRoutine]" ) have been integrated in cdEXIT above
437#define puts( STR ) Using_puts_before_cdEXIT_is_no_longer_needed
438
440void ShowMe(void);
441
443NORETURN void TotalInsanity(void);
444
445/* TotalInsanityAsStub always calls TotalInsanity(), but in such a way that
446 * it can be used as a stub for another routine without generating warnings
447 * about unreachable code after the stub. Hence this should NOT be NORETURN */
448template<class T>
450{
451 // this is always true...
452 if( ZeroNum == 0. )
454 else
455 return T();
456}
457
459NORETURN void BadRead(void);
460
464int dbg_printf(int debug, const char *fmt, ...);
465
467int dprintf(FILE *fp, const char *format, ...);
468
477char *read_whole_line( char *chLine , int nChar , FILE *ioIN );
478
479/**************************************************************************
480 *
481 * various macros used by the code
482 *
483 **************************************************************************/
484
488#ifndef NDEBUG
489# define DEBUG
490#else
491# undef DEBUG
492#endif
493
495#if defined(malloc)
496/* ...but if malloc is a macro, assume it is instrumented by a memory debugging tool
497 * (e.g. dmalloc) */
498# define MALLOC(exp) (malloc(exp))
499#else
500/* Otherwise instrument and protect it ourselves */
501# define MALLOC(exp) (MyMalloc(exp,__FILE__, __LINE__))
502#endif
503
505#if defined(calloc)
506/* ...but if calloc is a macro, assume it is instrumented by a memory debugging tool */
507# define CALLOC calloc
508#else
509/* Otherwise instrument and protect it ourselves */
510# define CALLOC MyCalloc
511#endif
512
514#if defined(realloc)
515/* ...but if calloc is a macro, assume it is instrumented by a memory debugging tool */
516# define REALLOC realloc
517#else
518/* Otherwise instrument and protect it ourselves */
519# define REALLOC MyRealloc
520#endif
521
523{
524 int p_sig;
525public:
526 explicit bad_signal(int sig)
527 {
528 p_sig = sig;
529 }
530 virtual ~bad_signal() throw() {}
531 int sig() const throw()
532 {
533 return p_sig;
534 }
535};
536
538{
539 const char* p_file;
540 long p_line;
541 const char* p_comment;
542public:
543 bad_assert(const char* file, long line, const char* comment);
544 void print(void) const
545 {
546 fprintf(ioQQQ,"DISASTER Assertion failure at %s:%ld\n%s\n",
548 }
549 virtual ~bad_assert() throw()
550 {
551 p_file = NULL;
552 }
553 const char* file() const throw()
554 {
555 return p_file;
556 }
557 long line() const throw()
558 {
559 return p_line;
560 }
561 const char *comment() const throw()
562 {
563 return p_comment;
564 }
565};
566
567/* the do { ... } while ( 0 ) construct prevents bugs in code like this:
568 * if( test )
569 * ASSERT( n == 10 );
570 * else
571 * do something else...
572 */
573#undef ASSERT
574#ifndef OLD_ASSERT
575# if NDEBUG
576# define ASSERT(exp) ((void)0)
577# else
578# define ASSERT(exp) \
579 do { \
580 if (UNLIKELY(!(exp))) \
581 { \
582 bad_assert aa(__FILE__,__LINE__,"Failed: " #exp); \
583 if( cpu.i().lgAssertAbort() ) \
584 { \
585 aa.print(); \
586 abort(); \
587 } \
588 else \
589 throw aa; \
590 } \
591 } while( 0 )
592# endif
593#else
595# ifdef NDEBUG
596# define ASSERT(exp) ((void)0)
597# else
598# define ASSERT(exp) \
599 do { \
600 if (!(exp)) \
601 MyAssert(__FILE__, __LINE__, "Failed: " #exp); \
602 } while( 0 )
603# endif
604#endif
605
606#define MESSAGE_ASSERT(msg, exp) ASSERT( (msg) ? (exp) : false )
607
608inline NORETURN void OUT_OF_RANGE(const char* str)
609{
610 if( cpu.i().lgAssertAbort() )
611 abort();
612 else
613 throw out_of_range( str );
614}
615
616/* Windows does not define isnan */
617/* use our version on all platforms since the isnanf
618 * function does not exist under Solaris 9 either */
619#undef isnan
620#define isnan MyIsnan
621
624class t_debug : public Singleton<t_debug>
625{
626 friend class Singleton<t_debug>;
627 FILE *p_fp;
629protected:
630 t_debug() : p_fp(stderr)
631 {
632 p_callLevel = 0;
633 }
634public:
635 void enter(const char *name)
636 {
637 ++p_callLevel;
638 fprintf(p_fp,"%*c%s\n",p_callLevel,'>',name);
639 }
640 void leave(const char *name)
641 {
642 fprintf(p_fp,"%*c%s\n",p_callLevel,'<',name);
643 --p_callLevel;
644 }
645};
646
649class t_nodebug : public Singleton<t_nodebug>
650{
651 friend class Singleton<t_nodebug>;
652protected:
654public:
655 void enter(const char *) const {}
656 void leave(const char *) const {}
657};
658
659template<class Trace>
661{
662 const char *p_name;
663public:
664 explicit debugtrace(const char *funcname)
665 {
666 p_name = funcname;
667 Trace::Inst().enter(p_name);
668 }
670 {
671 Trace::Inst().leave(p_name);
672 p_name = NULL;
673 }
674 const char* name() const
675 {
676 return p_name;
677 }
678};
679
680#ifdef DEBUG_FUN
681#define DEBUG_ENTRY( funcname ) debugtrace<t_debug> DEBUG_ENTRY( funcname )
682#else
683#ifdef HAVE_FUNC
684#define DEBUG_ENTRY( funcname ) ((void)0)
685#else
686#define DEBUG_ENTRY( funcname ) debugtrace<t_nodebug> DEBUG_ENTRY( funcname )
687#endif
688#endif
689
690// overload the character manipulation routines
691inline char tolower(char c)
692{
693 return static_cast<char>( tolower( static_cast<int>(c) ) );
694}
695inline unsigned char tolower(unsigned char c)
696{
697 return static_cast<unsigned char>( tolower( static_cast<int>(c) ) );
698}
699
700inline char toupper(char c)
701{
702 return static_cast<char>( toupper( static_cast<int>(c) ) );
703}
704inline unsigned char toupper(unsigned char c)
705{
706 return static_cast<unsigned char>( toupper( static_cast<int>(c) ) );
707}
708
709/* TorF(l) returns a 'T' or 'F' depending on the 'logical' expr 'l' */
710inline char TorF( bool l ) { return l ? 'T' : 'F'; }
711/* */
712
714inline bool is_odd( int j ) { return (j&1) == 1; }
715inline bool is_odd( long j ) { return (j&1L) == 1L; }
716/* */
717
719inline long nint( double x ) { return static_cast<long>( (x < 0.) ? x-0.5 : x+0.5 ); }
720/* */
721
722/* define min for mixed arguments, the rest already exists */
723inline long min( int a, long b ) { long c = a; return ( (c < b) ? c : b ); }
724inline long min( long a, int b ) { long c = b; return ( (a < c) ? a : c ); }
725inline double min( sys_float a, double b ) { double c = a; return ( (c < b) ? c : b ); }
726inline double min( double a, sys_float b ) { double c = b; return ( (a < c) ? a : c ); }
727
728/* want to define this only if no native os support exists */
729#ifndef HAVE_POWI
731double powi( double , long int );
732#endif
733
734/* avoid ambiguous overloads */
735#ifndef HAVE_POW_DOUBLE_INT
736inline double pow( double x, int i ) { return powi( x, long(i) ); }
737#endif
738
739#ifndef HAVE_POW_DOUBLE_LONG
740inline double pow( double x, long i ) { return powi( x, i ); }
741#endif
742
743#ifndef HAVE_POW_FLOAT_INT
744inline sys_float pow( sys_float x, int i ) { return sys_float( powi( double(x), long(i) ) ); }
745#endif
746
747#ifndef HAVE_POW_FLOAT_LONG
748inline sys_float pow( sys_float x, long i ) { return sys_float( powi( double(x), i ) ); }
749#endif
750
751#ifndef HAVE_POW_FLOAT_DOUBLE
752inline double pow( sys_float x, double y ) { return pow( double(x), y ); }
753#endif
754
755#ifndef HAVE_POW_DOUBLE_FLOAT
756inline double pow( double x, sys_float y ) { return pow( x, double(y) ); }
757#endif
758
759#undef MIN2
761#define MIN2 min
762/* */
763
764#undef MIN3
766#define MIN3(a,b,c) (min(min(a,b),c))
767/* */
768
769#undef MIN4
771#define MIN4(a,b,c,d) (min(min(a,b),min(c,d)))
772/* */
773
774/* define max for mixed arguments, the rest already exists */
775inline long max( int a, long b ) { long c = a; return ( (c > b) ? c : b ); }
776inline long max( long a, int b ) { long c = b; return ( (a > c) ? a : c ); }
777inline double max( sys_float a, double b ) { double c = a; return ( (c > b) ? c : b ); }
778inline double max( double a, sys_float b ) { double c = b; return ( (a > c) ? a : c ); }
779
780#undef MAX2
782#define MAX2 max
783/* */
784
785#undef MAX3
787#define MAX3(a,b,c) (max(max(a,b),c))
788/* */
789
790#undef MAX4
792#define MAX4(a,b,c,d) (max(max(a,b),max(c,d)))
793/* */
794
799template<class T>
800inline T sign( T x, T y )
801{
802 return ( y < T() ) ? -abs(x) : abs(x);
803}
804/* */
805
807template<class T>
808inline int sign3( T x ) { return ( x < T() ) ? -1 : ( ( x > T() ) ? 1 : 0 ); }
809/* */
810
812inline bool fp_equal( sys_float x, sys_float y, int n=3 )
813{
814#ifdef _MSC_VER
815 /* disable warning that conditional expression is constant, true or false in if */
816# pragma warning( disable : 4127 )
817#endif
818 ASSERT( n >= 1 );
819 // mimic IEEE behavior
820 if( isnan(x) || isnan(y) )
821 return false;
822 int sx = sign3(x);
823 int sy = sign3(y);
824 // treat zero cases first to avoid division by zero below
825 if( sx == 0 && sy == 0 )
826 return true;
827 // either x or y is zero (but not both), or x and y have different sign
828 if( sx*sy != 1 )
829 return false;
830 x = abs(x);
831 y = abs(y);
832 return ( 1.f - min(x,y)/max(x,y) < ((sys_float)n+0.1f)*FLT_EPSILON );
833}
834
835inline bool fp_equal( double x, double y, int n=3 )
836{
837 ASSERT( n >= 1 );
838 // mimic IEEE behavior
839 if( isnan(x) || isnan(y) )
840 return false;
841 int sx = sign3(x);
842 int sy = sign3(y);
843 // treat zero cases first to avoid division by zero below
844 if( sx == 0 && sy == 0 )
845 return true;
846 // either x or y is zero (but not both), or x and y have different sign
847 if( sx*sy != 1 )
848 return false;
849 x = abs(x);
850 y = abs(y);
851 return ( 1. - min(x,y)/max(x,y) < ((double)n+0.1)*DBL_EPSILON );
852}
853
855{
856 ASSERT( tol > 0.f );
857 // mimic IEEE behavior
858 if( isnan(x) || isnan(y) )
859 return false;
860 // make sure the tolerance is not too stringent
861 ASSERT( tol >= FLT_EPSILON*max(abs(x),abs(y)) );
862 return ( abs( x-y ) <= tol );
863}
864
865inline bool fp_equal_tol( double x, double y, double tol )
866{
867 ASSERT( tol > 0. );
868 // mimic IEEE behavior
869 if( isnan(x) || isnan(y) )
870 return false;
871 // make sure the tolerance is not too stringent
872 ASSERT( tol >= DBL_EPSILON*max(abs(x),abs(y)) );
873 return ( abs( x-y ) <= tol );
874}
875
877inline bool fp_bound( sys_float lo, sys_float x, sys_float hi, int n=3 )
878{
879 ASSERT( n >= 1 );
880 // mimic IEEE behavior
881 if( isnan(x) || isnan(lo) || isnan(hi) )
882 return false;
883 if( fp_equal(lo,hi,n) )
884 return fp_equal(0.5f*(lo+hi),x,n);
885 if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -((sys_float)n+0.1f)*FLT_EPSILON )
886 return false;
887 return true;
888}
889inline bool fp_bound( double lo, double x, double hi, int n=3 )
890{
891 ASSERT( n >= 1 );
892 // mimic IEEE behavior
893 if( isnan(x) || isnan(lo) || isnan(hi) )
894 return false;
895 if( fp_equal(lo,hi,n) )
896 return fp_equal(0.5*(lo+hi),x,n);
897 if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -((double)n+0.1)*DBL_EPSILON )
898 return false;
899 return true;
900}
902{
903 ASSERT( tol > 0.f );
904 // mimic IEEE behavior
905 if( isnan(x) || isnan(lo) || isnan(hi) )
906 return false;
907 if( fp_equal_tol(lo,hi,tol) )
908 return fp_equal_tol(0.5f*(lo+hi),x,tol);
909 if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -tol )
910 return false;
911 return true;
912}
913inline bool fp_bound_tol( double lo, double x, double hi, double tol )
914{
915 ASSERT( tol > 0. );
916 // mimic IEEE behavior
917 if( isnan(x) || isnan(lo) || isnan(hi) )
918 return false;
919 if( fp_equal_tol(lo,hi,tol) )
920 return fp_equal_tol(0.5*(lo+hi),x,tol);
921 if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -tol )
922 return false;
923 return true;
924}
925
926
927#undef POW2
929#define POW2 pow2
930template<class T>
931inline T pow2(T a) { return a*a; }
932/* */
933
934#undef POW3
936#define POW3 pow3
937template<class T>
938inline T pow3(T a) { return a*a*a; }
939/* */
940
941#undef POW4
943#define POW4 pow4
944template<class T>
945inline T pow4(T a) { T b = a*a; return b*b; }
946/* */
947
948#undef SDIV
952inline sys_float SDIV( sys_float x ) { return ( fabs((double)x) < (double)SMALLFLOAT ) ? (sys_float)SMALLFLOAT : x; }
953/* \todo should we use SMALLDOUBLE here ? it produces overflows now... PvH */
954inline double SDIV( double x ) { return ( fabs(x) < (double)SMALLFLOAT ) ? (double)SMALLFLOAT : x; }
955// inline double SDIV( double x ) { return ( fabs(x) < SMALLDOUBLE ) ? SMALLDOUBLE : x; }
956/* */
957
962{
963 // this should crash...
964 if( isnan(x) || isnan(y) )
965 return x/y;
966 int sx = sign3(x);
967 int sy = sign3(y);
968 // 0/0 -> NaN, this should crash as well...
969 if( sx == 0 && sy == 0 )
970 {
971 if( isnan(res_0by0) )
972 return x/y;
973 else
974 return res_0by0;
975 }
976 if( sx == 0 )
977 return 0.;
978 if( sy == 0 )
979 return ( sx < 0 ) ? -FLT_MAX : FLT_MAX;
980 // at this stage x != 0. and y != 0.
981 sys_float ay = abs(y);
982 if( ay >= 1.f )
983 return x/y;
984 else
985 {
986 // multiplication is safe since ay < 1.
987 if( abs(x) < ay*FLT_MAX )
988 return x/y;
989 else
990 return ( sx*sy < 0 ) ? -FLT_MAX : FLT_MAX;
991 }
992}
993
995{
996 return safe_div( x, y, numeric_limits<sys_float>::quiet_NaN() );
997}
998
1002inline double safe_div(double x, double y, double res_0by0)
1003{
1004 // this should crash...
1005 if( isnan(x) || isnan(y) )
1006 return x/y;
1007 int sx = sign3(x);
1008 int sy = sign3(y);
1009 // 0/0 -> NaN, this should crash as well...
1010 if( sx == 0 && sy == 0 )
1011 {
1012 if( isnan(res_0by0) )
1013 return x/y;
1014 else
1015 return res_0by0;
1016 }
1017 if( sx == 0 )
1018 return 0.;
1019 if( sy == 0 )
1020 return ( sx < 0 ) ? -DBL_MAX : DBL_MAX;
1021 // at this stage x != 0. and y != 0.
1022 double ay = abs(y);
1023 if( ay >= 1. )
1024 return x/y;
1025 else
1026 {
1027 // multiplication is safe since ay < 1.
1028 if( abs(x) < ay*DBL_MAX )
1029 return x/y;
1030 else
1031 return ( sx*sy < 0 ) ? -DBL_MAX : DBL_MAX;
1032 }
1033}
1034
1035inline double safe_div(double x, double y)
1036{
1037 return safe_div( x, y, numeric_limits<double>::quiet_NaN() );
1038}
1039
1040#undef HMRATE
1041/*HMRATE compile molecular rates using Hollenbach and McKee fits */
1042/* #define HMRATE(a,b,c) ( ((b) == 0 && (c) == 0) ? (a) : \
1043 * ( ((c) == 0) ? (a)*pow(phycon.te/300.,(b)) : \
1044 * ( ((c)/phycon.te > 50.) ? 0. : ( ((b) == 0) ? (a)*exp(-(c)/phycon.te) : \
1045 * (a)*pow(phycon.te/300.,(b))*exp(-(c)/phycon.te) ) ) ) ) */
1046#define HMRATE(a,b,c) hmrate4(a,b,c,phycon.te)
1047
1048inline double hmrate4( double a, double b, double c, double te )
1049{
1050 if( b == 0. && c == 0. )
1051 return a;
1052 else if( c == 0. )
1053 return a*pow(te/300.,b);
1054 else if( b == 0. )
1055 return ( c/te <= 50. ) ? a*exp(-c/te) : 0.;
1056 else
1057 return ( c/te <= 50. ) ? a*pow(te/300.,b)*exp(-c/te) : 0.;
1058}
1059
1060template<class T>
1061inline void invalidate_array(T* p, size_t size)
1062{
1063 if( size > 0 )
1064 memset( p, -1, size );
1065}
1066
1067inline void invalidate_array(double* p, size_t size)
1068{
1069 set_NaN( p, (long)(size/sizeof(double)) );
1070}
1071
1072inline void invalidate_array(sys_float* p, size_t size)
1073{
1074 set_NaN( p, (long)(size/sizeof(sys_float)) );
1075}
1076
1079template<class T> inline T* get_ptr(T *v)
1080{
1081 return v;
1082}
1083template<class T> inline T* get_ptr(valarray<T> &v)
1084{
1085 return &v[0];
1086}
1087template<class T> inline T* get_ptr(vector<T> &v)
1088{
1089 return &v[0];
1090}
1091template<class T> inline const T* get_ptr(const valarray<T> &v)
1092{
1093 return const_cast<const T*>(&const_cast<valarray<T>&>(v)[0]);
1094}
1095template<class T> inline const T* get_ptr(const vector<T> &v)
1096{
1097 return const_cast<const T*>(&const_cast<vector<T>&>(v)[0]);
1098}
1099
1125template<class T>
1127{
1129
1130 template<class U>
1132 {
1134
1135 explicit auto_vec_ref( U* p )
1136 {
1137 ptr = p;
1138 }
1139 };
1140
1141public:
1142 typedef T element_type;
1143
1144 // 20.4.5.1 construct/copy/destroy:
1145
1146 explicit auto_vec( element_type* p = NULL ) throw()
1147 {
1148 ptr = p;
1149 }
1150 auto_vec( auto_vec& p ) throw()
1151 {
1152 ptr = p.release();
1153 }
1155 {
1156 reset( p.release() );
1157 return *this;
1158 }
1159 ~auto_vec() throw()
1160 {
1161 delete[] ptr;
1162 }
1163
1164 // 20.4.5.2 members:
1165
1166 element_type& operator[] ( ptrdiff_t n ) const throw()
1167 {
1168 return *(ptr+n);
1169 }
1170 element_type* get() const throw()
1171 {
1172 return ptr;
1173 }
1174 // for consistency with other container classes
1175 element_type* data() const throw()
1176 {
1177 return ptr;
1178 }
1180 {
1181 element_type* p = ptr;
1182 ptr = NULL;
1183 return p;
1184 }
1185 void reset( element_type* p = NULL ) throw()
1186 {
1187 if( p != ptr )
1188 {
1189 delete[] ptr;
1190 ptr = p;
1191 }
1192 }
1193
1194 // 20.4.5.3 conversions:
1195
1197 {
1198 ptr = r.ptr;
1199 }
1201 {
1202 if( r.ptr != ptr )
1203 {
1204 delete[] ptr;
1205 ptr = r.ptr;
1206 }
1207 return *this;
1208 }
1210 {
1211 return auto_vec_ref<element_type>( this->release() );
1212 }
1213};
1214
1215#include "container_classes.h"
1216#include "iter_track.h"
1217
1218/*Many structure were introduced by Humeshkar B Nemala as a part of his Thesis
1219 *The structures were designed to read in transition,radiative and collisional data
1220 *from two major databases:LEIDEN and CHIANTI
1221
1222 * these structures define the emission, collision, state, and transition classes*/
1223
1224typedef struct t_species species;
1225
1226#include "lines_service.h"
1227
1228/*The species structure is used to hold information about a particular atom,ion or molecule
1229mentioned in the species.ini file.The name of the atom/ion/molecule is used to obtain the density
1230of molecules in the case of the Leiden Database and along with atomic number and ion stage the
1231density of atoms/ions in the case of the CHIANTI database */
1233{
1234 /*Name of the atom/ion/ molecule*/
1235 char *chLabel;
1236 // index in chmeistry
1237 long index;
1238 /*Actual Number of energy levels in the data file*/
1240 /*Number of energy levels used locally*/
1242 /*Molecular weight*/
1244 /* is molecular? */
1246 // intrepret data as LAMDA or CHIANTI?
1248 /* fraction in this "type" (e.g. para, ortho) */
1250 /* chemical fractionation */
1256 /* maximum wavenumber in chianti */
1257 double maxWN;
1259 bool lgLTE;
1260};
1261
1262/*This structure is specifically used to hold the collision data in the format given in the LEIDEN Database
1263The data is available as collision rate coefficients(cm3 s-1) over different temperatures*/
1264typedef struct t_CollRatesArray
1265{
1266 /*Array of temps*/
1267 vector<double> temps;
1268 /*Matrix of collision rates(temp,up,lo)*/
1270
1272
1273/*This structure is specifically used to hold the collision data in the format given in the CHIANTI Database
1274The data is available as spline fits to the Maxwellian averaged collision strengths */
1276{
1277 /*Matrix of spline fits(hi,lo,spline index)*
1278 *The first five columns gives the no of spline pts,transition type,gf value,delta E
1279 *& Scaling parameter ,in the specified order*/
1280 /*The transition type basically tells how the temperature and collision
1281 strengths have been scaled*/
1282 double *collspline;
1284
1289
1291
1292/*This structure is specifically used to hold the collision data in the format given in the STOUT Database
1293The data are available as collision strengths and rates over different temperatures*/
1294typedef struct t_StoutColls
1295{
1296 /*Number of temps*/
1298 /*Array of temps*/
1299 double *temps;
1300 /*Array of collision strengths*/
1301 double *collstrs;
1302 /*Is this a deexcitation rate or collision strength*/
1304
1306
1307#include "physconst.h"
1308
1309/***************************************************************************
1310 *
1311 * a series of Cloudy service routines, used throughout code,
1312 *
1313 **************************************************************************/
1314
1322
1324void Split(const string& str, // input string
1325 const string& sep, // separator, may be multiple characters
1326 vector<string>& lst, // the separated items will be appended here
1327 split_mode mode); // see above
1328
1331inline bool FindAndReplace(string& str,
1332 const string& substr,
1333 const string& newstr)
1334{
1335 string::size_type ptr = str.find( substr );
1336 if( ptr != string::npos )
1337 str.replace( ptr, substr.length(), newstr );
1338 return ptr != string::npos;
1339}
1340
1343inline bool FindAndErase(string& str,
1344 const string& substr)
1345{
1346 return FindAndReplace( str, substr, "" );
1347}
1348
1354double csphot(long int inu, long int ithr, long int iofset);
1355
1360double RandGauss(double xMean, double s );
1361
1365double MyGaussRand( double PctUncertainty );
1366
1368double AnuUnit(realnum energy);
1369
1374void cap4(char *chCAP , const char *chLab);
1375
1378void uncaps(char *chCard );
1379
1382void caps(char *chCard );
1383
1386double e2(
1387 double t );
1388
1391double ee1(double x);
1392
1396double ee1_safe(double x);
1397
1404double FFmtRead(const char *chCard,
1405 long int *ipnt,
1406 long int last,
1407 bool *lgEOL);
1408
1414long nMatch(const char *chKey,
1415 const char *chCard);
1416
1426int GetQuote( char *chLabel, char *chCard, char *chCardRaw, bool lgABORT );
1427
1428// these are safe versions of strstr, strchr, etc to work around a deficiency in glibc
1429inline const char *strstr_s(const char *haystack, const char *needle)
1430{
1431 return const_cast<const char *>(strstr(haystack, needle));
1432}
1433
1434inline char *strstr_s(char *haystack, const char *needle)
1435{
1436 return const_cast<char *>(strstr(haystack, needle));
1437}
1438
1439inline const char *strchr_s(const char *s, int c)
1440{
1441 return const_cast<const char *>(strchr(s, c));
1442}
1443
1444inline char *strchr_s(char *s, int c)
1445{
1446 return const_cast<char *>(strchr(s, c));
1447}
1448
1451long int ipow( long, long );
1452
1455void PrintE82( FILE*, double );
1456
1458void PrintE71( FILE*, double );
1459
1461void PrintE93( FILE*, double );
1462
1468// prevent compiler warnings on non-MS systems
1469#ifdef _MSC_VER
1470char *PrintEfmt(const char *fmt, double val );
1471#else
1472#define PrintEfmt( F, V ) F, V
1473#endif
1474
1476const double SEXP_LIMIT = 84.;
1478const double DSEXP_LIMIT = 680.;
1479
1482double sexp(double x);
1483
1487
1488double dsexp(double x);
1489
1493
1494double plankf(long int ip);
1495
1496// safe version of getline() that correctly handles all types of EOL lf, crlf and cr...
1497istream& SafeGetline(istream& is, string& t);
1498
1499// Define integration methods
1500typedef enum { Gaussian32, Legendre } methods;
1501
1502// define an integrator class. Currently hard-wired to 32-point Gaussian
1503template<typename Integrand, methods Method>
1505{
1506public:
1507 double numPoints, weights[16], c[16];
1508
1510 {
1511 numPoints = 16;
1512 double weights_temp[16] = {
1513 .35093050047350483e-2, .81371973654528350e-2, .12696032654631030e-1, .17136931456510717e-1,
1514 .21417949011113340e-1, .25499029631188088e-1, .29342046739267774e-1, .32911111388180923e-1,
1515 .36172897054424253e-1, .39096947893535153e-1, .41655962113473378e-1, .43826046502201906e-1,
1516 .45586939347881942e-1, .46922199540402283e-1, .47819360039637430e-1, .48270044257363900e-1};
1517
1518 double c_temp[16] = {
1519 .498631930924740780, .49280575577263417, .4823811277937532200, .46745303796886984000,
1520 .448160577883026060, .42468380686628499, .3972418979839712000, .36609105937014484000,
1521 .331522133465107600, .29385787862038116, .2534499544661147000, .21067563806531767000,
1522 .165934301141063820, .11964368112606854, .7223598079139825e-1, .24153832843869158e-1};
1523
1524 for( long i=0; i<numPoints; i++ )
1525 {
1526 weights[i] = weights_temp[i];
1527 c[i] = c_temp[i];
1528 }
1529 return;
1530 };
1531 double sum(double min, double max, Integrand func)
1532 {
1533 ASSERT( Method == Gaussian32 );
1534 double a = 0.5*(max+min),
1535 b = max-min,
1536 total = 0.;
1537
1538 for( long i=0; i< numPoints; i++ )
1539 total += b * weights[i] * ( func(a+b*c[i]) + func(a-b*c[i]) );
1540
1541 return total;
1542 }
1543};
1544
1551double qg32( double, double, double(*)(double) );
1552/* declar of optimize_func, the last arg, changed from double(*)() to above,
1553 * seemed to fix flags that were raised */
1554
1555
1565void spsort( realnum x[], long int n, long int iperm[], int kflag, int *ier);
1566
1567/**************************************************************************
1568 *
1569 * disable some bogus errors in the ms c compiler
1570 *
1571 **************************************************************************/
1572
1573/* */
1574#ifdef _MSC_VER
1575 /* disable warning that conditional expression is constant, true or false in if */
1576# pragma warning( disable : 4127 )
1577 /* disable strcat warning */
1578# pragma warning( disable : 4996 )
1579 /* disable bogus underflow warning in MS VS*/
1580# pragma warning( disable : 4056 )
1581 /* disable "inline function removed since not used", MS VS*/
1582# pragma warning( disable : 4514 )
1583 /* disable "assignment operator could not be generated", cddefines.h
1584 * line 126 */
1585# pragma warning( disable : 4512 )
1586#endif
1587#ifdef __INTEL_COMPILER
1588# pragma warning( disable : 1572 )
1589#endif
1590/* */
1591
1592/*lint +e129 these resolve several issues pclint has with my system headers */
1593/*lint +e78 */
1594/*lint +e830 */
1595/*lint +e38 */
1596/*lint +e148 */
1597/*lint +e114 */
1598/*lint +e18 */
1599/*lint +e49 */
1600
1601#endif /* CDDEFINES_H_ */
1602
long int nzone
Definition cddefines.cpp:14
FILE * ioPrnErr
Definition cddefines.cpp:9
bool lgTestCodeCalled
Definition cddefines.cpp:11
FILE * ioQQQ
Definition cddefines.cpp:7
bool lgTestCodeEnabled
Definition cddefines.cpp:12
FILE * ioStdin
Definition cddefines.cpp:8
bool lgPrnErr
Definition cddefines.cpp:13
bool lgAbort
Definition cddefines.cpp:10
long int iteration
Definition cddefines.cpp:16
double fnzone
Definition cddefines.cpp:15
float sys_float
Definition cddefines.h:106
double csphot(long int inu, long int ithr, long int iofset)
Definition service.cpp:1602
double plankf(long int ip)
Definition service.cpp:1707
const int FILENAME_PATH_LENGTH_2
Definition cddefines.h:249
const int FILENAME_PATH_LENGTH
Definition cddefines.h:246
#define isnan
Definition cddefines.h:620
#define ASSERT(exp)
Definition cddefines.h:578
sys_float sexp(sys_float x)
Definition service.cpp:914
@ CHARS_ISOTOPE_SYM
Definition cddefines.h:275
void * MyMalloc(size_t size, const char *file, int line)
Definition service.cpp:1448
bool is_odd(int j)
Definition cddefines.h:714
double MyGaussRand(double PctUncertainty)
Definition service.cpp:1683
const int ipSILICON
Definition cddefines.h:318
bool FindAndReplace(string &str, const string &substr, const string &newstr)
Definition cddefines.h:1331
#define PrintEfmt(F, V)
Definition cddefines.h:1472
const int ipRecEsc
Definition cddefines.h:279
const int ipBERYLLIUM
Definition cddefines.h:308
const double MAX_DENSITY
Definition cddefines.h:269
const int ipDEST_INCOM
Definition cddefines.h:300
const double DSEXP_LIMIT
Definition cddefines.h:1478
const int ipCHROMIUM
Definition cddefines.h:328
struct t_CollSplinesArray CollSplinesArray
const double SEXP_LIMIT
Definition cddefines.h:1476
long nMatch(const char *chKey, const char *chCard)
Definition service.cpp:451
char tolower(char c)
Definition cddefines.h:691
const int ipNITROGEN
Definition cddefines.h:311
double ee1_safe(double x)
Definition service.cpp:356
const int ipZINC
Definition cddefines.h:334
const int ipIRON
Definition cddefines.h:330
void * MyCalloc(size_t num, size_t size)
Definition service.cpp:1533
exit_type
Definition cddefines.h:115
@ ES_FAILURE
Definition cddefines.h:117
@ ES_BOTCHES
Definition cddefines.h:119
@ ES_SEGFAULT
Definition cddefines.h:128
@ ES_TOP
Definition cddefines.h:132
@ ES_USER_INTERRUPT
Definition cddefines.h:124
@ ES_TERMINATION_REQUEST
Definition cddefines.h:125
@ ES_WARNINGS
Definition cddefines.h:118
@ ES_BUS_ERROR
Definition cddefines.h:129
@ ES_BAD_ASSERT
Definition cddefines.h:121
@ ES_UNKNOWN_SIGNAL
Definition cddefines.h:130
@ ES_SUCCESS
Definition cddefines.h:116
@ ES_UNKNOWN_EXCEPTION
Definition cddefines.h:131
@ ES_OUT_OF_RANGE
Definition cddefines.h:123
@ ES_BAD_ALLOC
Definition cddefines.h:122
@ ES_ILLEGAL_INSTRUCTION
Definition cddefines.h:126
@ ES_FP_EXCEPTION
Definition cddefines.h:127
@ ES_CLOUDY_ABORT
Definition cddefines.h:120
const int ipCARBON
Definition cddefines.h:310
methods
Definition cddefines.h:1500
@ Legendre
Definition cddefines.h:1500
@ Gaussian32
Definition cddefines.h:1500
T pow2(T a)
Definition cddefines.h:931
const int ipSCANDIUM
Definition cddefines.h:325
@ CHARS_SPECIES
Definition cddefines.h:274
const int ipALUMINIUM
Definition cddefines.h:317
const int ipOXYGEN
Definition cddefines.h:312
const int NHYDRO_MAX_LEVEL
Definition cddefines.h:266
struct t_species species
Definition cddefines.h:1224
void PrintE93(FILE *, double)
Definition service.cpp:838
void broken(void)
Definition service.cpp:982
FILE * ioMAP
Definition cdinit.cpp:9
const double DEPTH_OFFSET
Definition cddefines.h:272
int sign3(T x)
Definition cddefines.h:808
double qg32(double, double, double(*)(double))
Definition service.cpp:1053
struct t_CollRatesArray CollRateCoeffArray
NORETURN void BadRead(void)
Definition service.cpp:901
void TestCode(void)
Definition service.cpp:972
const int ipCOPPER
Definition cddefines.h:333
void CodeReview(void)
Definition service.cpp:1000
void PrintE82(FILE *, double)
Definition service.cpp:739
double fudge(long int ipnt)
Definition service.cpp:481
double ee1(double x)
Definition service.cpp:312
const int LIMELM
Definition cddefines.h:258
const int ipPHOSPHORUS
Definition cddefines.h:319
const int INPUT_LINE_LENGTH
Definition cddefines.h:254
T sign(T x, T y)
Definition cddefines.h:800
struct t_StoutColls StoutColls
const int ipLITHIUM
Definition cddefines.h:307
sys_float safe_div(sys_float x, sys_float y, sys_float res_0by0)
Definition cddefines.h:961
int dbg_printf(int debug, const char *fmt,...)
Definition service.cpp:1031
int dprintf(FILE *fp, const char *format,...)
Definition service.cpp:1009
const double ZeroNum
Definition cdinit.cpp:13
const int ipMAGNESIUM
Definition cddefines.h:316
const int ipVANADIUM
Definition cddefines.h:327
double RandGauss(double xMean, double s)
Definition service.cpp:1643
const int ipBORON
Definition cddefines.h:309
const int ipSODIUM
Definition cddefines.h:315
NORETURN void OUT_OF_RANGE(const char *str)
Definition cddefines.h:608
void cap4(char *chCAP, const char *chLab)
Definition service.cpp:240
void MyAssert(const char *file, int line, const char *comment)
Definition service.cpp:153
const int ipTITANIUM
Definition cddefines.h:326
char toupper(char c)
Definition cddefines.h:700
char TorF(bool l)
Definition cddefines.h:710
const int ipCOBALT
Definition cddefines.h:331
void Split(const string &str, const string &sep, vector< string > &lst, split_mode mode)
Definition service.cpp:106
void PrintE71(FILE *, double)
Definition service.cpp:788
double AnuUnit(realnum energy)
Definition service.cpp:173
T TotalInsanityAsStub()
Definition cddefines.h:449
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)
Definition service.cpp:381
bool fp_bound_tol(sys_float lo, sys_float x, sys_float hi, sys_float tol)
Definition cddefines.h:901
const int NISO
Definition cddefines.h:261
FILE * ioQQQ
Definition cddefines.cpp:7
void * MyRealloc(void *p, size_t size)
Definition service.cpp:1569
const char * strstr_s(const char *haystack, const char *needle)
Definition cddefines.h:1429
const int ipHELIUM
Definition cddefines.h:306
int GetQuote(char *chLabel, char *chCard, char *chCardRaw, bool lgABORT)
Definition service.cpp:513
double hmrate4(double a, double b, double c, double te)
Definition cddefines.h:1048
const int ipRecNetEsc
Definition cddefines.h:281
float realnum
Definition cddefines.h:103
const int ipFLUORINE
Definition cddefines.h:313
long int ipow(long, long)
Definition service.cpp:639
const int ipNICKEL
Definition cddefines.h:332
const char * strchr_s(const char *s, int c)
Definition cddefines.h:1439
bool fp_bound(sys_float lo, sys_float x, sys_float hi, int n=3)
Definition cddefines.h:877
T * get_ptr(T *v)
Definition cddefines.h:1079
const int ipSULPHUR
Definition cddefines.h:320
long nint(double x)
Definition cddefines.h:719
const int ipCALCIUM
Definition cddefines.h:324
const int ipDEST_K2
Definition cddefines.h:298
const int ipDEST_SIMPL
Definition cddefines.h:302
long max(int a, long b)
Definition cddefines.h:775
bool fp_equal(sys_float x, sys_float y, int n=3)
Definition cddefines.h:812
void caps(char *chCard)
Definition service.cpp:280
const int ipCRDW
Definition cddefines.h:294
double e2(double t)
Definition service.cpp:299
const int ipPOTASSIUM
Definition cddefines.h:323
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
Definition service.cpp:70
void spsort(realnum x[], long int n, long int iperm[], int kflag, int *ier)
Definition service.cpp:1100
NORETURN void TotalInsanity(void)
Definition service.cpp:886
sys_float SDIV(sys_float x)
Definition cddefines.h:952
const int ipHYDROGEN
Definition cddefines.h:305
double dsexp(double x)
Definition service.cpp:953
bool FindAndErase(string &str, const string &substr)
Definition cddefines.h:1343
const int ipRecRad
Definition cddefines.h:283
T pow4(T a)
Definition cddefines.h:945
const int ipNEON
Definition cddefines.h:314
const int ipCRD
Definition cddefines.h:292
const int ipCHLORINE
Definition cddefines.h:321
long min(int a, long b)
Definition cddefines.h:723
const int ipKRYPTON
Definition cddefines.h:335
void cdPrepareExit(exit_type)
Definition cdinit.cpp:202
split_mode
Definition cddefines.h:1321
@ SPM_RELAX
Definition cddefines.h:1321
@ SPM_STRICT
Definition cddefines.h:1321
@ SPM_KEEP_EMPTY
Definition cddefines.h:1321
const int ipMANGANESE
Definition cddefines.h:329
void uncaps(char *chCard)
Definition service.cpp:263
void invalidate_array(T *p, size_t size)
Definition cddefines.h:1061
const int ipARGON
Definition cddefines.h:322
const int ipLY_A
Definition cddefines.h:296
bool fp_equal_tol(sys_float x, sys_float y, sys_float tol)
Definition cddefines.h:854
T pow3(T a)
Definition cddefines.h:938
void ShowMe(void)
Definition service.cpp:181
void fixit(void)
Definition service.cpp:991
double powi(double, long int)
Definition service.cpp:604
istream & SafeGetline(istream &is, string &t)
Definition service.cpp:1770
const int ipPRD
Definition cddefines.h:290
double weights[16]
Definition cddefines.h:1507
Integrator(void)
Definition cddefines.h:1509
double numPoints
Definition cddefines.h:1507
double c[16]
Definition cddefines.h:1507
double sum(double min, double max, Integrand func)
Definition cddefines.h:1531
static T & Inst()
Definition cddefines.h:175
void reset(element_type *p=NULL)
Definition cddefines.h:1185
element_type * data() const
Definition cddefines.h:1175
auto_vec(auto_vec &p)
Definition cddefines.h:1150
auto_vec(element_type *p=NULL)
Definition cddefines.h:1146
element_type * get() const
Definition cddefines.h:1170
element_type * release()
Definition cddefines.h:1179
element_type & operator[](ptrdiff_t n) const
Definition cddefines.h:1166
auto_vec(auto_vec_ref< element_type > r)
Definition cddefines.h:1196
auto_vec & operator=(auto_vec &p)
Definition cddefines.h:1154
void print(void) const
Definition cddefines.h:544
const char * comment() const
Definition cddefines.h:561
const char * file() const
Definition cddefines.h:553
long p_line
Definition cddefines.h:540
const char * p_file
Definition cddefines.h:539
const char * p_comment
Definition cddefines.h:541
long line() const
Definition cddefines.h:557
virtual ~bad_assert()
Definition cddefines.h:549
bad_assert(const char *file, long line, const char *comment)
Definition cddefines.cpp:17
int sig() const
Definition cddefines.h:531
virtual ~bad_signal()
Definition cddefines.h:530
bad_signal(int sig)
Definition cddefines.h:526
const char * file() const
Definition cddefines.h:419
long line() const
Definition cddefines.h:423
const char * p_file
Definition cddefines.h:399
const char * p_routine
Definition cddefines.h:398
exit_type p_exit
Definition cddefines.h:401
exit_type exit_status() const
Definition cddefines.h:427
virtual ~cloudy_exit()
Definition cddefines.h:410
const char * routine() const
Definition cddefines.h:415
cloudy_exit(const char *routine, const char *file, long line, exit_type exit_code)
Definition cddefines.h:403
const char * p_name
Definition cddefines.h:662
const char * name() const
Definition cddefines.h:674
debugtrace(const char *funcname)
Definition cddefines.h:664
void leave(const char *name)
Definition cddefines.h:640
FILE * p_fp
Definition cddefines.h:627
int p_callLevel
Definition cddefines.h:628
void enter(const char *name)
Definition cddefines.h:635
void leave(const char *) const
Definition cddefines.h:656
void enter(const char *) const
Definition cddefines.h:655
void set_NaN(sys_float &x)
Definition cpu.cpp:682
static t_cpu cpu
Definition cpu.h:355
#define NORETURN
Definition cpu.h:383
const realnum SMALLFLOAT
Definition cpu.h:191
vector< double > temps
Definition cddefines.h:1267
multi_arr< double, 3 > collrates
Definition cddefines.h:1269
double * SplineSecDer
Definition cddefines.h:1283
double * collstrs
Definition cddefines.h:1301
double * temps
Definition cddefines.h:1299
bool lgActive
Definition cddefines.h:1255
double maxWN
Definition cddefines.h:1257
long numLevels_max
Definition cddefines.h:1239
double CoolTotal
Definition cddefines.h:1253
bool lgMolecular
Definition cddefines.h:1245
long numLevels_local
Definition cddefines.h:1241
realnum fracIsotopologue
Definition cddefines.h:1251
char * chLabel
Definition cddefines.h:1235
realnum fracType
Definition cddefines.h:1249
realnum fmolweight
Definition cddefines.h:1243
bool lgLAMDA
Definition cddefines.h:1247