cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cddefines.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2017 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 // prevent problems on platforms with broken support (such as Mac homebrew g++)
84 #ifndef HAVE_AVX_INTRIN
85 #undef __AVX__
86 #endif
87 
88 #ifndef HAVE_FMA_INTRIN
89 #undef __FMA__
90 #endif
91 
92 #ifndef HAVE_AVX2_INTRIN
93 #undef __AVX2__
94 #endif
95 
96 #ifndef HAVE_AVX512F_INTRIN
97 #undef __AVX512F__
98 #endif
99 
100 #ifdef __AVX__
101 #include <immintrin.h>
102 #endif
103 
104 /*lint +e18 */
105 /*lint +e49 */
106 /*lint +e38 */
107 /*lint +e148 */
108 /*lint +e830 */
109 /*lint +e78 */
110 /*lint -e129 */
111 
112 using namespace std;
113 
114 #undef STATIC
115 #ifdef USE_GPROF
116 #define STATIC
117 #else
118 #define STATIC static
119 #endif
120 
121 #ifdef FLT_IS_DBL
122 typedef double realnum;
123 #else
124 typedef float realnum;
125 #endif
126 
127 typedef float sys_float;
128 // prevent explicit float's from creeping back into the code
129 #define float PLEASE_USE_REALNUM_NOT_FLOAT
130 
131 inline FILE *sys_fopen(const char *path, const char *mode)
132 {
133  return fopen( path, mode );
134 }
135 #define fopen PLEASE_USE_open_data_NOT_fopen
136 
137 //Compile-time assertion after Alexandrescu
138 template<bool> struct StaticAssertFailed;
139 template<> struct StaticAssertFailed<true> {};
140 #define STATIC_ASSERT(x) ((void)StaticAssertFailed< (x) == true >())
141 
142 typedef enum {
143  ES_SUCCESS=0, // everything went fine...
144  ES_FAILURE=1, // general failure exit
145  ES_WARNINGS, // warnings were present
146  ES_BOTCHES, // botched monitors were present
147  ES_CLOUDY_ABORT, // Cloudy aborted
148  ES_BAD_ASSERT, // an assert in the code failed
149  ES_BAD_ALLOC, // a memory allocation failed
150  ES_OUT_OF_RANGE, // an out-of-range exception was thrown
151  ES_DOMAIN_ERROR, // a vectorized math routine threw a domain error
152  ES_USER_INTERRUPT, // the user terminated Cloudy (with ^C)
153  ES_TERMINATION_REQUEST, // Cloudy received a termination request
154  ES_ILLEGAL_INSTRUCTION, // the CPU encountered an illegal instruction
155  ES_FP_EXCEPTION, // a floating point exception was caught
156  ES_SEGFAULT, // a segmentation fault occurred
157  ES_BUS_ERROR, // a bus error occurred
158  ES_UNKNOWN_SIGNAL, // an unknown signal was caught
159  ES_UNKNOWN_EXCEPTION, // an unknown exception was caught
160  ES_TOP // NB NB -- this should always be the last entry
161 } exit_type;
162 
163 // make sure the system definitions are on par with ours
164 // especially EXIT_FAILURE does not have a guaranteed value!
165 #undef EXIT_SUCCESS
166 #define EXIT_SUCCESS ES_SUCCESS
167 #undef EXIT_FAILURE
168 #define EXIT_FAILURE ES_FAILURE
169 
170 #ifdef BOUNDS_CHECK
171 #define lgBOUNDSCHECKVAL true
172 #else
173 #define lgBOUNDSCHECKVAL false
174 #endif
175 
176 /* make sure this is globally visible as well! */
177 /* This must be done at the start of every file, to ensure that policy
178  for FPE handling, etc., is guaranteed to be set up before the
179  construction of file-statics and globals. */
180 #include "cpu.h"
181 
182 //*************************************************************************
183 //
201 //
202 // This implementation has been obtained from Wikipedia
203 //
204 //*************************************************************************
205 
206 template<typename T> class Singleton
207 {
208 public:
209  static T& Inst()
210  {
211  static T instance; // assumes T has a protected default constructor
212  return instance;
213  }
214 };
215 
216 /**************************************************************************
217  *
218  * these are variables and pointers for output from the code, used everywhere
219  * declared extern here, and definition is in cddefines.cpp
220  *
221  **************************************************************************/
222 
227 class Output
228 {
229 public:
230  FILE *m_fp;
231  // Implicit conversion
232  Output(FILE* fp) : m_fp(fp) {}
233  FILE *fptr() const
234  {
235  return m_fp;
236  }
237 };
238 
239 extern FILE *ioQQQ;
240 
241 extern FILE *ioStdin;
242 
243 extern FILE *ioMAP;
244 
247 extern FILE* ioPrnErr;
248 
250 extern bool lgAbort;
251 
254 extern bool lgTestCodeCalled;
255 
258 extern bool lgTestCodeEnabled;
259 
262 extern bool lgPrnErr;
263 
266 extern long int nzone;
267 
269 extern double fnzone;
270 
273 extern long int iteration;
274 
281 extern const double ZeroNum;
282 
283 /**************************************************************************
284  *
285  * these are constants used to dimension several vectors and index arrays
286  *
287  **************************************************************************/
288 
293 const int FILENAME_PATH_LENGTH = 200;
294 
297 
301 const int INPUT_LINE_LENGTH = 2000;
302 
303 const int NCHLAB = 10;
304 
307 const int LIMELM = 30;
308 
310 const int NISO = 2;
311 
315 const int NHYDRO_MAX_LEVEL = 401;
316 
318 const double MAX_DENSITY = 1.e24;
319 
321 const double DEPTH_OFFSET = 1.e-30;
322 
323 enum {CHARS_SPECIES=10};
324 enum {CHARS_ISOTOPE_SYM = 6};
325 
326 /* indices within recombination coefficient array */
327 /* ipRecEsc is state specific escape probability*/
328 const int ipRecEsc = 2;
329 /* the net escaping, including destruction by background and optical deepth*/
330 const int ipRecNetEsc = 1;
331 /* ipRecRad is state specific radiative recombination rate*/
332 const int ipRecRad = 0;
337 /* these specify the form of the line redistribution function */
338 /* partial redistribution with wings */
339 const int ipPRD = 1;
340 /* complete redistribution, core only, no wings, Hummer's K2 function */
341 const int ipCRD = -1;
342 /* complete redistribution with wings */
343 const int ipCRDW = 2;
344 /* redistribution function for Lya, calls Hummer routine for H-like series only */
345 const int ipLY_A = -2;
346 
348 const int ipHYDROGEN = 0;
349 const int ipHELIUM = 1;
350 const int ipLITHIUM = 2;
351 const int ipBERYLLIUM = 3;
352 const int ipBORON = 4;
353 const int ipCARBON = 5;
354 const int ipNITROGEN = 6;
355 const int ipOXYGEN = 7;
356 const int ipFLUORINE = 8;
357 const int ipNEON = 9;
358 const int ipSODIUM = 10;
359 const int ipMAGNESIUM = 11;
360 const int ipALUMINIUM = 12;
361 const int ipSILICON = 13;
362 const int ipPHOSPHORUS = 14;
363 const int ipSULPHUR = 15;
364 const int ipCHLORINE = 16;
365 const int ipARGON = 17;
366 const int ipPOTASSIUM = 18;
367 const int ipCALCIUM = 19;
368 const int ipSCANDIUM = 20;
369 const int ipTITANIUM = 21;
370 const int ipVANADIUM = 22;
371 const int ipCHROMIUM = 23;
372 const int ipMANGANESE = 24;
373 const int ipIRON = 25;
374 const int ipCOBALT = 26;
375 const int ipNICKEL = 27;
376 const int ipCOPPER = 28;
377 const int ipZINC = 29;
378 const int ipKRYPTON = 35;
379 
380 /***************************************************************************
381  * the following are prototypes for some routines that are part of the
382  * debugging process - they come and go in any particular sub.
383  * it is not necessary to declare them when used since they are defined here
384  **************************************************************************/
385 
394 double fudge(long int ipnt);
395 
399 void broken(void);
400 
403 void fixit_base(const char* func, const char* file, int line,
404  const char *reason);
405 
406 class Fixit
407 {
408 public:
409  Fixit(const char* func, const char* file, int line,
410  const char *reason)
411  {
412  fixit_base(func,file,line,reason);
413  }
414 };
415 
416 #define fixit(a) \
417  do { \
418  static Fixit fixit_s(__func__,__FILE__,__LINE__, (a)); \
419  } while (0)
420 
422 void CodeReview(void);
423 
425 void TestCode(void);
426 
432 void *MyMalloc(size_t size, const char *file, int line);
433 
435 void *MyMalloc_avx(size_t size, const char *file, int line);
436 
441 void MyAssert(const char *file, int line, const char *comment);
442 
445 
447 {
448  const char* p_routine;
449  const char* p_file;
450  long p_line;
452 public:
453  cloudy_exit(const char* routine, const char* file, long line, exit_type exit_code)
454  {
455  p_routine = routine;
456  p_file = file;
457  p_line = line;
458  p_exit = exit_code;
459  }
460  virtual ~cloudy_exit() throw()
461  {
462  p_routine = NULL;
463  p_file = NULL;
464  }
465  const char* routine() const throw()
466  {
467  return p_routine;
468  }
469  const char* file() const throw()
470  {
471  return p_file;
472  }
473  long line() const
474  {
475  return p_line;
476  }
478  {
479  return p_exit;
480  }
481 };
482 
483 // workarounds for __func__ are defined in cpu.h
484 #define cdEXIT( FAIL ) throw cloudy_exit( __func__, __FILE__, __LINE__, FAIL )
485 
486 // calls like puts( "[Stop in MyRoutine]" ) have been integrated in cdEXIT above
487 #define puts( STR ) Using_puts_before_cdEXIT_is_no_longer_needed
488 
490 void ShowMe(void);
491 
493 NORETURN void TotalInsanity(void);
494 
495 /* TotalInsanityAsStub always calls TotalInsanity(), but in such a way that
496  * it can be used as a stub for another routine without generating warnings
497  * about unreachable code after the stub. Hence this should NOT be NORETURN */
498 template<class T>
500 {
501  // this is always true...
502  if( ZeroNum == 0. )
503  TotalInsanity();
504  else
505  return T();
506 }
507 
509 NORETURN void BadRead(void);
510 
514 int dbg_printf(int debug, const char *fmt, ...);
515 
517 int dprintf(FILE *fp, const char *format, ...);
518 
520 int fprintf (const Output& stream, const char *format, ...);
521 
522 int dprintf(const Output & stream, const char *format, ...);
523 
532 char *read_whole_line( char *chLine , int nChar , FILE *ioIN );
533 
534 /**************************************************************************
535  *
536  * various macros used by the code
537  *
538  **************************************************************************/
539 
543 #ifndef NDEBUG
544 # define DEBUG
545 #else
546 # undef DEBUG
547 #endif
548 
550 #if defined(malloc)
551 /* ...but if malloc is a macro, assume it is instrumented by a memory debugging tool
552  * (e.g. dmalloc) */
553 # define MALLOC(exp) (malloc(exp))
554 #else
555 /* Otherwise instrument and protect it ourselves */
556 # define MALLOC(exp) (MyMalloc(exp, __FILE__, __LINE__))
557 #endif
558 
559 #define MALLOC_AVX(exp) (MyMalloc_avx(exp, __FILE__, __LINE__))
560 
562 {
563  int p_sig;
564 public:
565  explicit bad_signal(int sig)
566  {
567  p_sig = sig;
568  }
569  virtual ~bad_signal() throw() {}
570  int sig() const throw()
571  {
572  return p_sig;
573  }
574 };
575 
577 {
578  const char* p_file;
579  long p_line;
580  const char* p_comment;
581 public:
582  bad_assert(const char* file, long line, const char* comment);
583  void print(void) const
584  {
585  fprintf(ioQQQ,"DISASTER Assertion failure at %s:%ld\n%s\n",
586  p_file, p_line, p_comment);
587  }
588  virtual ~bad_assert() throw()
589  {
590  p_file = NULL;
591  }
592  const char* file() const throw()
593  {
594  return p_file;
595  }
596  long line() const throw()
597  {
598  return p_line;
599  }
600  const char *comment() const throw()
601  {
602  return p_comment;
603  }
604 };
605 
606 /* the do { ... } while ( 0 ) construct prevents bugs in code like this:
607  * if( test )
608  * ASSERT( n == 10 );
609  * else
610  * do something else...
611  */
612 #undef ASSERT
613 #ifndef OLD_ASSERT
614 # if NDEBUG
615 # define ASSERT(exp) ((void)0)
616 # else
617 # define ASSERT(exp) \
618  do { \
619  if (UNLIKELY(!(exp))) \
620  { \
621  bad_assert aa(__FILE__,__LINE__,"Failed: " #exp); \
622  if( cpu.i().lgAssertAbort() ) \
623  { \
624  aa.print(); \
625  abort(); \
626  } \
627  else \
628  throw aa; \
629  } \
630  } while( 0 )
631 # endif
632 #else
633 
634 # ifdef NDEBUG
635 # define ASSERT(exp) ((void)0)
636 # else
637 # define ASSERT(exp) \
638  do { \
639  if (!(exp)) \
640  MyAssert(__FILE__, __LINE__, "Failed: " #exp); \
641  } while( 0 )
642 # endif
643 #endif
644 
645 #define MESSAGE_ASSERT(msg, exp) ASSERT( (msg) ? (exp) : false )
646 
647 inline NORETURN void OUT_OF_RANGE(const char* str)
648 {
649  if( cpu.i().lgAssertAbort() )
650  abort();
651  else
652  throw out_of_range( str );
653 }
654 
655 #ifdef __SUNPRO_CC
656 #pragma does_not_return(OUT_OF_RANGE)
657 #endif
658 
659 /* Windows does not define isnan */
660 /* use our version on all platforms since the isnanf
661  * function does not exist under Solaris 9 either */
662 #undef isnan
663 #define isnan MyIsnan
664 
667 class t_debug : public Singleton<t_debug>
668 {
669  friend class Singleton<t_debug>;
670  FILE *p_fp;
672 protected:
673  t_debug() : p_fp(stderr)
674  {
675  p_callLevel = 0;
676  }
677 public:
678  void enter(const char *name)
679  {
680  ++p_callLevel;
681  fprintf(p_fp,"%*c%s\n",p_callLevel,'>',name);
682  }
683  void leave(const char *name)
684  {
685  fprintf(p_fp,"%*c%s\n",p_callLevel,'<',name);
686  --p_callLevel;
687  }
688 };
689 
692 class t_nodebug : public Singleton<t_nodebug>
693 {
694  friend class Singleton<t_nodebug>;
695 protected:
697 public:
698  void enter(const char *) const {}
699  void leave(const char *) const {}
700 };
701 
702 template<class Trace>
704 {
705  const char *p_name;
706 public:
707  explicit debugtrace(const char *funcname)
708  {
709  p_name = funcname;
710  Trace::Inst().enter(p_name);
711  }
713  {
714  Trace::Inst().leave(p_name);
715  p_name = NULL;
716  }
717  const char* name() const
718  {
719  return p_name;
720  }
721 };
722 
723 #ifdef DEBUG_FUN
724 #define DEBUG_ENTRY( funcname ) debugtrace<t_debug> DEBUG_ENTRY( funcname )
725 #else
726 #ifdef HAVE_FUNC
727 #define DEBUG_ENTRY( funcname ) ((void)0)
728 #else
729 #define DEBUG_ENTRY( funcname ) debugtrace<t_nodebug> DEBUG_ENTRY( funcname )
730 #endif
731 #endif
732 
733 // overload the character manipulation routines
734 inline char tolower(char c)
735 {
736  return static_cast<char>( tolower( static_cast<int>(c) ) );
737 }
738 inline unsigned char tolower(unsigned char c)
739 {
740  return static_cast<unsigned char>( tolower( static_cast<int>(c) ) );
741 }
742 
743 inline char toupper(char c)
744 {
745  return static_cast<char>( toupper( static_cast<int>(c) ) );
746 }
747 inline unsigned char toupper(unsigned char c)
748 {
749  return static_cast<unsigned char>( toupper( static_cast<int>(c) ) );
750 }
751 
752 /* TorF(l) returns a 'T' or 'F' depending on the 'logical' expr 'l' */
753 inline char TorF( bool l ) { return l ? 'T' : 'F'; }
754 /* */
755 
757 inline bool is_odd( int j ) { return (j&1) == 1; }
758 inline bool is_odd( long j ) { return (j&1L) == 1L; }
759 /* */
760 
762 inline long nint( double x ) { return static_cast<long>( (x < 0.) ? x-0.5 : x+0.5 ); }
763 /* */
764 
765 /* define min for mixed arguments, the rest already exists */
766 inline long min( int a, long b ) { long c = a; return ( (c < b) ? c : b ); }
767 inline long min( long a, int b ) { long c = b; return ( (a < c) ? a : c ); }
768 inline double min( sys_float a, double b ) { double c = a; return ( (c < b) ? c : b ); }
769 inline double min( double a, sys_float b ) { double c = b; return ( (a < c) ? a : c ); }
770 
771 /* want to define this only if no native os support exists */
772 #ifndef HAVE_POWI
773 
774 double powi( double , long int );
775 #endif
776 
778 double powpq(double x, int p, int q);
779 
780 /* avoid ambiguous overloads */
781 #ifndef HAVE_POW_DOUBLE_INT
782 inline double pow( double x, int i ) { return powi( x, long(i) ); }
783 #endif
784 
785 #ifndef HAVE_POW_DOUBLE_LONG
786 inline double pow( double x, long i ) { return powi( x, i ); }
787 #endif
788 
789 #ifndef HAVE_POW_FLOAT_INT
790 inline sys_float pow( sys_float x, int i ) { return sys_float( powi( double(x), long(i) ) ); }
791 #endif
792 
793 #ifndef HAVE_POW_FLOAT_LONG
794 inline sys_float pow( sys_float x, long i ) { return sys_float( powi( double(x), i ) ); }
795 #endif
796 
797 #ifndef HAVE_POW_FLOAT_DOUBLE
798 inline double pow( sys_float x, double y ) { return pow( double(x), y ); }
799 #endif
800 
801 #ifndef HAVE_POW_DOUBLE_FLOAT
802 inline double pow( double x, sys_float y ) { return pow( x, double(y) ); }
803 #endif
804 
805 #undef MIN2
806 
807 #define MIN2(a,b) min(a,b)
808 /* */
809 
810 #undef MIN3
811 
812 #define MIN3(a,b,c) (min(min(a,b),c))
813 /* */
814 
815 #undef MIN4
816 
817 #define MIN4(a,b,c,d) (min(min(a,b),min(c,d)))
818 /* */
819 
820 /* define max for mixed arguments, the rest already exists */
821 inline long max( int a, long b ) { long c = a; return ( (c > b) ? c : b ); }
822 inline long max( long a, int b ) { long c = b; return ( (a > c) ? a : c ); }
823 inline double max( sys_float a, double b ) { double c = a; return ( (c > b) ? c : b ); }
824 inline double max( double a, sys_float b ) { double c = b; return ( (a > c) ? a : c ); }
825 
826 #undef MAX2
827 
828 #define MAX2(a,b) max(a,b)
829 /* */
830 
831 #undef MAX3
832 
833 #define MAX3(a,b,c) (max(max(a,b),c))
834 /* */
835 
836 #undef MAX4
837 
838 #define MAX4(a,b,c,d) (max(max(a,b),max(c,d)))
839 /* */
840 
845 template<class T>
846 inline T sign( T x, T y )
847 {
848  return ( y < T() ) ? -abs(x) : abs(x);
849 }
850 /* */
851 
853 template<class T>
854 inline int sign3( T x ) { return ( x < T() ) ? -1 : ( ( x > T() ) ? 1 : 0 ); }
855 /* */
856 
858 inline bool fp_equal( sys_float x, sys_float y, int n=3 )
859 {
860 #ifdef _MSC_VER
861  /* disable warning that conditional expression is constant, true or false in if */
862 # pragma warning( disable : 4127 )
863 #endif
864  ASSERT( n >= 1 );
865  // mimic IEEE behavior
866  if( isnan(x) || isnan(y) )
867  return false;
868  int sx = sign3(x);
869  int sy = sign3(y);
870  // treat zero cases first to avoid division by zero below
871  if( sx == 0 && sy == 0 )
872  return true;
873  // either x or y is zero (but not both), or x and y have different sign
874  if( sx*sy != 1 )
875  return false;
876  x = abs(x);
877  y = abs(y);
878  // adjust epsilon value for denormalized numbers
879  int exp;
880  (void)frexp(max(x,y), &exp);
881  sys_float epsilon = ldexp(FLT_EPSILON, max(0,FLT_MIN_EXP-exp));
882  return ( 1.f - min(x,y)/max(x,y) < ((sys_float)n+0.1f)*epsilon );
883 }
884 
885 inline bool fp_equal( double x, double y, int n=3 )
886 {
887  ASSERT( n >= 1 );
888  // mimic IEEE behavior
889  if( isnan(x) || isnan(y) )
890  return false;
891  int sx = sign3(x);
892  int sy = sign3(y);
893  // treat zero cases first to avoid division by zero below
894  if( sx == 0 && sy == 0 )
895  return true;
896  // either x or y is zero (but not both), or x and y have different sign
897  if( sx*sy != 1 )
898  return false;
899  x = abs(x);
900  y = abs(y);
901  // adjust epsilon value for denormalized numbers
902  int exp;
903  (void)frexp(max(x,y), &exp);
904  double epsilon = ldexp(DBL_EPSILON, max(0,DBL_MIN_EXP-exp));
905  return ( 1. - min(x,y)/max(x,y) < ((double)n+0.1)*epsilon );
906 }
907 
908 inline bool fp_equal_tol( sys_float x, sys_float y, sys_float tol )
909 {
910  ASSERT( tol > 0.f );
911  // mimic IEEE behavior
912  if( isnan(x) || isnan(y) )
913  return false;
914  // make sure the tolerance is not too stringent
915  ASSERT( tol >= FLT_EPSILON*max(abs(x),abs(y)) );
916  return ( abs( x-y ) <= tol );
917 }
918 
919 inline bool fp_equal_tol( double x, double y, double tol )
920 {
921  ASSERT( tol > 0. );
922  // mimic IEEE behavior
923  if( isnan(x) || isnan(y) )
924  return false;
925  // make sure the tolerance is not too stringent
926  ASSERT( tol >= DBL_EPSILON*max(abs(x),abs(y)) );
927  return ( abs( x-y ) <= tol );
928 }
929 
931 inline bool fp_bound( sys_float lo, sys_float x, sys_float hi, int n=3 )
932 {
933  ASSERT( n >= 1 );
934  // mimic IEEE behavior
935  if( isnan(x) || isnan(lo) || isnan(hi) )
936  return false;
937  if( fp_equal(lo,hi,n) )
938  return fp_equal(0.5f*(lo+hi),x,n);
939  if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -((sys_float)n+0.1f)*FLT_EPSILON )
940  return false;
941  return true;
942 }
943 inline bool fp_bound( double lo, double x, double hi, int n=3 )
944 {
945  ASSERT( n >= 1 );
946  // mimic IEEE behavior
947  if( isnan(x) || isnan(lo) || isnan(hi) )
948  return false;
949  if( fp_equal(lo,hi,n) )
950  return fp_equal(0.5*(lo+hi),x,n);
951  if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -((double)n+0.1)*DBL_EPSILON )
952  return false;
953  return true;
954 }
955 inline bool fp_bound_tol( sys_float lo, sys_float x, sys_float hi, sys_float tol )
956 {
957  ASSERT( tol > 0.f );
958  // mimic IEEE behavior
959  if( isnan(x) || isnan(lo) || isnan(hi) )
960  return false;
961  if( fp_equal_tol(lo,hi,tol) )
962  return fp_equal_tol(0.5f*(lo+hi),x,tol);
963  if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -tol )
964  return false;
965  return true;
966 }
967 inline bool fp_bound_tol( double lo, double x, double hi, double tol )
968 {
969  ASSERT( tol > 0. );
970  // mimic IEEE behavior
971  if( isnan(x) || isnan(lo) || isnan(hi) )
972  return false;
973  if( fp_equal_tol(lo,hi,tol) )
974  return fp_equal_tol(0.5*(lo+hi),x,tol);
975  if( ((hi-x)/(hi-lo))*((x-lo)/(hi-lo)) < -tol )
976  return false;
977  return true;
978 }
979 
980 
981 #undef POW2
982 
983 #define POW2 pow2
984 template<class T>
985 inline T pow2(T a) { return a*a; }
986 /* */
987 
988 #undef POW3
989 
990 #define POW3 pow3
991 template<class T>
992 inline T pow3(T a) { return a*a*a; }
993 /* */
994 
995 #undef POW4
996 
997 #define POW4 pow4
998 template<class T>
999 inline T pow4(T a) { T b = a*a; return b*b; }
1000 /* */
1001 
1002 #undef SDIV
1003 
1006 inline sys_float SDIV( sys_float x ) { return ( fabs((double)x) < (double)SMALLFLOAT ) ? (sys_float)SMALLFLOAT : x; }
1007 /* \todo should we use SMALLDOUBLE here ? it produces overflows now... PvH */
1008 inline double SDIV( double x ) { return ( fabs(x) < (double)SMALLFLOAT ) ? (double)SMALLFLOAT : x; }
1009 // inline double SDIV( double x ) { return ( fabs(x) < SMALLDOUBLE ) ? SMALLDOUBLE : x; }
1010 /* */
1011 
1016 {
1017  // this should crash...
1018  if( isnan(x) || isnan(y) )
1019  return x/y;
1020  int sx = sign3(x);
1021  int sy = sign3(y);
1022  // 0/0 -> NaN, this should crash as well...
1023  if( sx == 0 && sy == 0 )
1024  {
1025  if( isnan(res_0by0) )
1026  return x/y;
1027  else
1028  return res_0by0;
1029  }
1030  if( sx == 0 )
1031  return 0.;
1032  if( sy == 0 )
1033  return ( sx < 0 ) ? -FLT_MAX : FLT_MAX;
1034  // at this stage x != 0. and y != 0.
1035  sys_float ay = abs(y);
1036  if( ay >= 1.f )
1037  return x/y;
1038  else
1039  {
1040  // multiplication is safe since ay < 1.
1041  if( abs(x) < ay*FLT_MAX )
1042  return x/y;
1043  else
1044  return ( sx*sy < 0 ) ? -FLT_MAX : FLT_MAX;
1045  }
1046 }
1047 
1049 {
1050  return safe_div( x, y, numeric_limits<sys_float>::quiet_NaN() );
1051 }
1052 
1056 inline double safe_div(double x, double y, double res_0by0)
1057 {
1058  // this should crash...
1059  if( isnan(x) || isnan(y) )
1060  return x/y;
1061  int sx = sign3(x);
1062  int sy = sign3(y);
1063  // 0/0 -> NaN, this should crash as well...
1064  if( sx == 0 && sy == 0 )
1065  {
1066  if( isnan(res_0by0) )
1067  return x/y;
1068  else
1069  return res_0by0;
1070  }
1071  if( sx == 0 )
1072  return 0.;
1073  if( sy == 0 )
1074  return ( sx < 0 ) ? -DBL_MAX : DBL_MAX;
1075  // at this stage x != 0. and y != 0.
1076  double ay = abs(y);
1077  if( ay >= 1. )
1078  return x/y;
1079  else
1080  {
1081  // multiplication is safe since ay < 1.
1082  if( abs(x) < ay*DBL_MAX )
1083  return x/y;
1084  else
1085  return ( sx*sy < 0 ) ? -DBL_MAX : DBL_MAX;
1086  }
1087 }
1088 
1089 inline double safe_div(double x, double y)
1090 {
1091  return safe_div( x, y, numeric_limits<double>::quiet_NaN() );
1092 }
1093 
1094 template<class T>
1095 inline void invalidate_array(T* p, size_t size)
1096 {
1097  if( size > 0 )
1098  memset( p, -1, size );
1099 }
1100 
1101 inline void invalidate_array(double* p, size_t size)
1102 {
1103  set_NaN( p, (long)(size/sizeof(double)) );
1104 }
1105 
1106 inline void invalidate_array(sys_float* p, size_t size)
1107 {
1108  set_NaN( p, (long)(size/sizeof(sys_float)) );
1109 }
1110 
1113 template<class T> inline T* get_ptr(T *v)
1114 {
1115  return v;
1116 }
1117 template<class T> inline T* get_ptr(valarray<T> &v)
1118 {
1119  return &v[0];
1120 }
1121 template<class T, class U> inline T* get_ptr(vector<T,U> &v)
1122 {
1123  return &v[0];
1124 }
1125 template<class T> inline const T* get_ptr(const valarray<T> &v)
1126 {
1127  return const_cast<const T*>(&const_cast<valarray<T>&>(v)[0]);
1128 }
1129 template<class T, class U> inline const T* get_ptr(const vector<T,U> &v)
1130 {
1131  return const_cast<const T*>(&const_cast<vector<T,U>&>(v)[0]);
1132 }
1133 
1159 template<class T>
1161 {
1162  T* ptr;
1163 
1164  template<class U>
1166  {
1167  U* ptr;
1168 
1169  explicit auto_vec_ref( U* p )
1170  {
1171  ptr = p;
1172  }
1173  };
1174 
1175 public:
1176  typedef T element_type;
1177 
1178  // 20.4.5.1 construct/copy/destroy:
1179 
1180  explicit auto_vec( element_type* p = NULL ) throw()
1181  {
1182  ptr = p;
1183  }
1184  auto_vec( auto_vec& p ) throw()
1185  {
1186  ptr = p.release();
1187  }
1188  auto_vec& operator= ( auto_vec& p ) throw()
1189  {
1190  reset( p.release() );
1191  return *this;
1192  }
1193  ~auto_vec() throw()
1194  {
1195  delete[] ptr;
1196  }
1197 
1198  // 20.4.5.2 members:
1199 
1200  element_type& operator[] ( ptrdiff_t n ) const throw()
1201  {
1202  return *(ptr+n);
1203  }
1204  element_type* get() const throw()
1205  {
1206  return ptr;
1207  }
1208  // for consistency with other container classes
1209  element_type* data() const throw()
1210  {
1211  return ptr;
1212  }
1214  {
1215  element_type* p = ptr;
1216  ptr = NULL;
1217  return p;
1218  }
1219  void reset( element_type* p = NULL ) throw()
1220  {
1221  if( p != ptr )
1222  {
1223  delete[] ptr;
1224  ptr = p;
1225  }
1226  }
1227 
1228  // 20.4.5.3 conversions:
1229 
1231  {
1232  ptr = r.ptr;
1233  }
1234  auto_vec& operator= ( auto_vec_ref<element_type> r ) throw()
1235  {
1236  if( r.ptr != ptr )
1237  {
1238  delete[] ptr;
1239  ptr = r.ptr;
1240  }
1241  return *this;
1242  }
1243  operator auto_vec_ref<element_type>() throw()
1244  {
1245  return auto_vec_ref<element_type>( this->release() );
1246  }
1247 };
1248 
1254 double csphot(long int inu, long int ithr, long int iofset);
1255 
1260 double RandGauss(double xMean, double s );
1261 
1265 double MyGaussRand( double PctUncertainty );
1266 
1268 double AnuUnit(realnum energy);
1269 
1274 void cap4(char *chCAP , const char *chLab);
1275 
1278 void uncaps(char *chCard );
1279 
1282 void caps(char *chCard );
1283 
1290 double FFmtRead(const char *chCard,
1291  long int *ipnt,
1292  long int last,
1293  bool *lgEOL);
1294 
1300 long nMatch(const char *chKey,
1301  const char *chCard);
1302 
1312 int GetQuote( char *chLabel, char *chCard, char *chCardRaw, bool lgABORT );
1313 
1314 // these are safe versions of strstr, strchr, etc to work around a deficiency in glibc
1315 inline const char *strstr_s(const char *haystack, const char *needle)
1316 {
1317  return const_cast<const char *>(strstr(haystack, needle));
1318 }
1319 
1320 inline char *strstr_s(char *haystack, const char *needle)
1321 {
1322  return const_cast<char *>(strstr(haystack, needle));
1323 }
1324 
1325 inline const char *strchr_s(const char *s, int c)
1326 {
1327  return const_cast<const char *>(strchr(s, c));
1328 }
1329 
1330 inline char *strchr_s(char *s, int c)
1331 {
1332  return const_cast<char *>(strchr(s, c));
1333 }
1334 
1337 long int ipow( long, long );
1338 
1339 // this routine is fully equivalent to snprintf() apart from the fact that it
1340 // concatenates the output to an existing string rather than replacing it.
1341 size_t sncatf( char* buf, size_t bufSize, const char* fmt, ... );
1342 
1343 size_t sncatf( ostringstream& buf, const char* fmt, ... );
1344 
1347 void PrintE82( FILE*, double );
1348 
1350 void PrintE71( FILE*, double );
1351 
1353 void PrintE93( FILE*, double );
1354 
1360 // prevent compiler warnings on non-MS systems
1361 #ifdef _MSC_VER
1362 char *PrintEfmt(const char *fmt, double val );
1363 #else
1364 #define PrintEfmt( F, V ) F, V
1365 #endif
1366 
1368 const double SEXP_LIMIT = 84.;
1370 const double DSEXP_LIMIT = 680.;
1371 
1374 double sexp(double x);
1375 
1380 double dsexp(double x);
1381 
1383 inline double exp10(double x)
1384 {
1385  if( x < -330. )
1386  return 0.;
1387  else if( x > 310. )
1388  return pow2(BIGDOUBLE); // +Inf
1389  else
1390  {
1391  double y = trunc(x/3.);
1392  double z = 3.*y;
1393  x -= z;
1394  x *= 2.302585092994045684; // constant is ln(10)
1395  x -= 7.90550887243868070612e-3*z; // constant is ln(10)-10/3*ln(2)
1396  return ldexp(exp(x),10*int(y));
1397  }
1398 }
1399 
1402 {
1403  if( x < -50.f )
1404  return 0.f;
1405  else if( x > 40.f )
1406  return pow2(BIGFLOAT); // +Inf
1407  else
1408  {
1409  sys_float y = truncf(x/3.f);
1410  sys_float z = 3.f*y;
1411  x -= z;
1412  x *= 2.302585093f; // constant is ln(10)
1413  x -= 7.9055088724e-3f*z; // constant is ln(10)-10/3*ln(2)
1414  return ldexpf(expf(x),10*int(y));
1415  }
1416 }
1417 
1419 {
1420  return exp10f(x);
1421 }
1422 
1427 double plankf(long int ip);
1428 
1429 // safe version of getline() that correctly handles all types of EOL lf, crlf and cr...
1430 istream& SafeGetline(istream& is, string& t);
1431 
1441 void spsort( realnum x[], long int n, long int iperm[], int kflag, int *ier);
1442 
1443 /**************************************************************************
1444  *
1445  * disable some bogus errors in the ms c compiler
1446  *
1447  **************************************************************************/
1448 
1449 /* */
1450 #ifdef _MSC_VER
1451  /* disable warning that conditional expression is constant, true or false in if */
1452 # pragma warning( disable : 4127 )
1453  /* disable strcat warning */
1454 # pragma warning( disable : 4996 )
1455  /* disable bogus underflow warning in MS VS*/
1456 # pragma warning( disable : 4056 )
1457  /* disable "inline function removed since not used", MS VS*/
1458 # pragma warning( disable : 4514 )
1459  /* disable "assignment operator could not be generated", cddefines.h
1460  * line 126 */
1461 # pragma warning( disable : 4512 )
1462 #endif
1463 #ifdef __INTEL_COMPILER
1464 # pragma warning( disable : 1572 )
1465 #endif
1466 /* */
1467 
1468 /*lint +e129 these resolve several issues pclint has with my system headers */
1469 /*lint +e78 */
1470 /*lint +e830 */
1471 /*lint +e38 */
1472 /*lint +e148 */
1473 /*lint +e114 */
1474 /*lint +e18 */
1475 /*lint +e49 */
1476 
1477 #endif /* CDDEFINES_H_ */
1478 
const char * p_name
Definition: cddefines.h:705
T pow4(T a)
Definition: cddefines.h:999
FILE * ioMAP
Definition: cdinit.cpp:9
void leave(const char *name)
Definition: cddefines.h:683
const char * file() const
Definition: cddefines.h:592
const int ipBERYLLIUM
Definition: cddefines.h:351
void leave(const char *) const
Definition: cddefines.h:699
FILE * p_fp
Definition: cddefines.h:670
t_debug()
Definition: cddefines.h:673
void PrintE93(FILE *, double)
Definition: service.cpp:1019
const int ipMAGNESIUM
Definition: cddefines.h:359
int p_callLevel
Definition: cddefines.h:671
bool is_odd(int j)
Definition: cddefines.h:757
virtual ~bad_signal()
Definition: cddefines.h:569
exit_type exit_status() const
Definition: cddefines.h:477
double exp10(double x)
Definition: cddefines.h:1383
const int FILENAME_PATH_LENGTH_2
Definition: cddefines.h:296
#define NORETURN
Definition: cpu.h:451
istream & SafeGetline(istream &is, string &t)
Definition: service.cpp:1932
T * get_ptr(T *v)
Definition: cddefines.h:1113
NORETURN void TotalInsanity(void)
Definition: service.cpp:1067
const double BIGDOUBLE
Definition: cpu.h:249
void set_NaN(sys_float &x)
Definition: cpu.cpp:862
const int ipARGON
Definition: cddefines.h:365
const int ipTITANIUM
Definition: cddefines.h:369
const char * file() const
Definition: cddefines.h:469
const realnum SMALLFLOAT
Definition: cpu.h:246
t_cpu_i & i()
Definition: cpu.h:415
FILE * sys_fopen(const char *path, const char *mode)
Definition: cddefines.h:131
virtual ~cloudy_exit()
Definition: cddefines.h:460
const int NISO
Definition: cddefines.h:310
size_t sncatf(char *buf, size_t bufSize, const char *fmt,...)
Definition: service.cpp:812
const char * routine() const
Definition: cddefines.h:465
char TorF(bool l)
Definition: cddefines.h:753
const int ipOXYGEN
Definition: cddefines.h:355
const int ipCHLORINE
Definition: cddefines.h:364
#define PrintEfmt(F, V)
Definition: cddefines.h:1364
void enter(const char *) const
Definition: cddefines.h:698
void invalidate_array(T *p, size_t size)
Definition: cddefines.h:1095
long nMatch(const char *chKey, const char *chCard)
Definition: service.cpp:537
T sign(T x, T y)
Definition: cddefines.h:846
int sig() const
Definition: cddefines.h:570
const char * name() const
Definition: cddefines.h:717
bool fp_equal_tol(sys_float x, sys_float y, sys_float tol)
Definition: cddefines.h:908
T TotalInsanityAsStub()
Definition: cddefines.h:499
const char * strstr_s(const char *haystack, const char *needle)
Definition: cddefines.h:1315
void * MyMalloc(size_t size, const char *file, int line)
Definition: service.cpp:1739
sys_float sexp(sys_float x)
Definition: service.cpp:1095
const int ipRecNetEsc
Definition: cddefines.h:330
long line() const
Definition: cddefines.h:596
int dbg_printf(int debug, const char *fmt,...)
Definition: service.cpp:1249
T pow3(T a)
Definition: cddefines.h:992
bad_signal(int sig)
Definition: cddefines.h:565
double fudge(long int ipnt)
Definition: service.cpp:567
const int ipCOBALT
Definition: cddefines.h:374
FILE * ioQQQ
Definition: cddefines.cpp:7
NORETURN void OUT_OF_RANGE(const char *str)
Definition: cddefines.h:647
long int nzone
Definition: cddefines.cpp:14
const int ipNICKEL
Definition: cddefines.h:375
const int ipZINC
Definition: cddefines.h:377
exit_type
Definition: cddefines.h:142
void cap4(char *chCAP, const char *chLab)
Definition: service.cpp:264
Output(FILE *fp)
Definition: cddefines.h:232
const char * p_file
Definition: cddefines.h:578
double dsexp(double x)
Definition: service.cpp:1134
void CodeReview(void)
Definition: service.cpp:1189
const int ipSULPHUR
Definition: cddefines.h:363
bool fp_bound_tol(sys_float lo, sys_float x, sys_float hi, sys_float tol)
Definition: cddefines.h:955
void fixit_base(const char *func, const char *file, int line, const char *reason)
Definition: service.cpp:1172
const double MAX_DENSITY
Definition: cddefines.h:318
static T & Inst()
Definition: cddefines.h:209
bool lgAssertAbort() const
Definition: cpu.h:382
void uncaps(char *chCard)
Definition: service.cpp:287
char toupper(char c)
Definition: cddefines.h:743
void print(void) const
Definition: cddefines.h:583
element_type * data() const
Definition: cddefines.h:1209
#define fopen
Definition: cddefines.h:135
long int iteration
Definition: cddefines.cpp:16
const double DSEXP_LIMIT
Definition: cddefines.h:1370
int GetQuote(char *chLabel, char *chCard, char *chCardRaw, bool lgABORT)
Definition: service.cpp:599
bool fp_equal(sys_float x, sys_float y, int n=3)
Definition: cddefines.h:858
void broken(void)
Definition: service.cpp:1163
debugtrace(const char *funcname)
Definition: cddefines.h:707
int dprintf(FILE *fp, const char *format,...)
Definition: service.cpp:1198
const int ipVANADIUM
Definition: cddefines.h:370
const int ipIRON
Definition: cddefines.h:373
void PrintE71(FILE *, double)
Definition: service.cpp:969
sys_float exp10f(sys_float x)
Definition: cddefines.h:1401
char tolower(char c)
Definition: cddefines.h:734
element_type * release()
Definition: cddefines.h:1213
double energy(const genericState &gs)
const char * p_routine
Definition: cddefines.h:448
const int ipSCANDIUM
Definition: cddefines.h:368
auto_vec(element_type *p=NULL)
Definition: cddefines.h:1180
Fixit(const char *func, const char *file, int line, const char *reason)
Definition: cddefines.h:409
const double ZeroNum
Definition: cdinit.cpp:13
const int ipCRD
Definition: cddefines.h:341
void enter(const char *name)
Definition: cddefines.h:678
FILE * m_fp
Definition: cddefines.h:230
virtual ~bad_assert()
Definition: cddefines.h:588
long p_line
Definition: cddefines.h:450
float realnum
Definition: cddefines.h:124
float sys_float
Definition: cddefines.h:127
const int ipLY_A
Definition: cddefines.h:345
const realnum BIGFLOAT
Definition: cpu.h:244
const int ipPHOSPHORUS
Definition: cddefines.h:362
const int INPUT_LINE_LENGTH
Definition: cddefines.h:301
long max(int a, long b)
Definition: cddefines.h:821
int sign3(T x)
Definition: cddefines.h:854
const char * p_file
Definition: cddefines.h:449
const int ipNEON
Definition: cddefines.h:357
const int ipCHROMIUM
Definition: cddefines.h:371
double powi(double, long int)
Definition: service.cpp:690
const int ipRecRad
Definition: cddefines.h:332
long min(int a, long b)
Definition: cddefines.h:766
bool fp_bound(sys_float lo, sys_float x, sys_float hi, int n=3)
Definition: cddefines.h:931
long p_line
Definition: cddefines.h:579
const char * strchr_s(const char *s, int c)
Definition: cddefines.h:1325
sys_float safe_div(sys_float x, sys_float y, sys_float res_0by0)
Definition: cddefines.h:1015
const int ipRecEsc
Definition: cddefines.h:328
void * MyMalloc_avx(size_t size, const char *file, int line)
Definition: service.cpp:1750
exit_type p_exit
Definition: cddefines.h:451
double RandGauss(double xMean, double s)
Definition: service.cpp:1805
void reset(element_type *p=NULL)
Definition: cddefines.h:1219
const int ipKRYPTON
Definition: cddefines.h:378
double AnuUnit(realnum energy)
Definition: service.cpp:197
void MyAssert(const char *file, int line, const char *comment)
Definition: service.cpp:177
auto_vec(auto_vec &p)
Definition: cddefines.h:1184
bool lgTestCodeEnabled
Definition: cddefines.cpp:12
const int ipSILICON
Definition: cddefines.h:361
const char * comment() const
Definition: cddefines.h:600
long int ipow(long, long)
Definition: service.cpp:754
#define ASSERT(exp)
Definition: cddefines.h:617
FILE * fptr() const
Definition: cddefines.h:233
FILE * ioPrnErr
Definition: cddefines.cpp:9
const int ipALUMINIUM
Definition: cddefines.h:360
const char * p_comment
Definition: cddefines.h:580
const int ipCALCIUM
Definition: cddefines.h:367
const int ipNITROGEN
Definition: cddefines.h:354
double csphot(long int inu, long int ithr, long int iofset)
Definition: service.cpp:1764
const int LIMELM
Definition: cddefines.h:307
T pow2(T a)
Definition: cddefines.h:985
const int ipFLUORINE
Definition: cddefines.h:356
auto_vec(auto_vec_ref< element_type > r)
Definition: cddefines.h:1230
double powpq(double x, int p, int q)
Definition: service.cpp:726
#define isnan
Definition: cddefines.h:663
const int ipHELIUM
Definition: cddefines.h:349
const int ipMANGANESE
Definition: cddefines.h:372
long line() const
Definition: cddefines.h:473
bool lgTestCodeCalled
Definition: cddefines.cpp:11
const int NCHLAB
Definition: cddefines.h:303
const int FILENAME_PATH_LENGTH
Definition: cddefines.h:293
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1217
const int ipPRD
Definition: cddefines.h:339
sys_float SDIV(sys_float x)
Definition: cddefines.h:1006
double pow(double x, int i)
Definition: cddefines.h:782
bool lgPrnErr
Definition: cddefines.cpp:13
const int ipCARBON
Definition: cddefines.h:353
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
Definition: service.cpp:72
cloudy_exit(const char *routine, const char *file, long line, exit_type exit_code)
Definition: cddefines.h:453
long nint(double x)
Definition: cddefines.h:762
double MyGaussRand(double PctUncertainty)
Definition: service.cpp:1845
void caps(char *chCard)
Definition: service.cpp:304
static t_cpu cpu
Definition: cpu.h:423
double fnzone
Definition: cddefines.cpp:15
void ShowMe(void)
Definition: service.cpp:205
void PrintE82(FILE *, double)
Definition: service.cpp:920
const double SEXP_LIMIT
Definition: cddefines.h:1368
double plankf(long int ip)
Definition: service.cpp:1869
const int ipHYDROGEN
Definition: cddefines.h:348
const int ipLITHIUM
Definition: cddefines.h:350
void cdPrepareExit(exit_type)
Definition: cdinit.cpp:132
const double DEPTH_OFFSET
Definition: cddefines.h:321
void TestCode(void)
Definition: service.cpp:1153
const int ipPOTASSIUM
Definition: cddefines.h:366
const int NHYDRO_MAX_LEVEL
Definition: cddefines.h:315
NORETURN void BadRead(void)
Definition: service.cpp:1082
T element_type
Definition: cddefines.h:1176
const int ipBORON
Definition: cddefines.h:352
bool lgAbort
Definition: cddefines.cpp:10
const int ipCRDW
Definition: cddefines.h:343
const int ipSODIUM
Definition: cddefines.h:358
void spsort(realnum x[], long int n, long int iperm[], int kflag, int *ier)
Definition: service.cpp:1318
FILE * ioStdin
Definition: cddefines.cpp:8
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)
Definition: service.cpp:393
const int ipCOPPER
Definition: cddefines.h:376