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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/lend/src/nf_utilities.cc (Version 11.3.0) and /processes/hadronic/models/lend/src/nf_utilities.cc (Version 2.0)


  1 /*                                                  1 
  2 # <<BEGIN-copyright>>                             
  3 # <<END-copyright>>                               
  4 */                                                
  5                                                   
  6 #include <stdio.h>                                
  7 #include <stdlib.h>                               
  8 #include <cmath>                                  
  9                                                   
 10 #include "nf_utilities.h"                         
 11                                                   
 12 #ifdef WIN32                                      
 13 #include <float.h>                                
 14 #define is_nan(a) _isnan(a)                       
 15 /*#define INFINITY (DBL_MAX+DBL_MAX)*/            
 16 /*#define NAN (INFINITY-INFINITY)*/               
 17 #else                                             
 18 #define is_nan(a) std::isnan(a)                   
 19 #endif                                            
 20                                                   
 21 #if defined __cplusplus                           
 22 namespace GIDI {                                  
 23 using namespace GIDI;                             
 24 #endif                                            
 25                                                   
 26 static const char Okay_message[] = "all is oka    
 27 static const char mallocError_message[] = "cou    
 28 static const char insufficientMemory_message[]    
 29 static const char badIndex_message[] = "bad in    
 30 static const char XNotAscending_message[] = "x    
 31 static const char badIndexForX_message[] = "in    
 32 static const char XOutsideDomain_message[] = "    
 33 static const char invalidInterpolation_message    
 34 static const char badSelf_message[] = "source     
 35 static const char divByZero_message[] = "divis    
 36 static const char unsupportedInterpolation_mes    
 37 static const char unsupportedInterpolationConv    
 38 static const char empty_message[] = "empty ins    
 39 static const char tooFewPoints_message[] = "to    
 40 static const char notMutualDomian_message[] =     
 41 static const char unknownStatus_message[] = "u    
 42 static const char badInput_message[] = "bad in    
 43 static const char badNorm_message[] = "bad nor    
 44 static const char badIntegrationInput_message[    
 45 static const char otherInterpolation_message[]    
 46 static const char failedToConverge_message[] =    
 47 static const char oddNumberOfValues_message[]     
 48                                                   
 49 static int nfu_debugging = 0;                     
 50                                                   
 51 /*                                                
 52 **********************************************    
 53 */                                                
 54 double nfu_getNAN( void ) {                       
 55                                                   
 56     return( NAN );                                
 57 }                                                 
 58 /*                                                
 59 **********************************************    
 60 */                                                
 61 int nfu_isNAN( double d ) {                       
 62                                                   
 63     return( is_nan( d ) );                        
 64 }                                                 
 65 /*                                                
 66 **********************************************    
 67 */                                                
 68 double nfu_getInfinity( double sign ) {           
 69                                                   
 70     if( sign < 0 ) return( -INFINITY );           
 71     return( INFINITY );                           
 72 }                                                 
 73 /*                                                
 74 **********************************************    
 75 */                                                
 76 const char *nfu_statusMessage( nfu_status stat    
 77                                                   
 78     switch( status ) {                            
 79     case nfu_Okay : return( Okay_message );       
 80     case nfu_mallocError : return( mallocError    
 81     case nfu_insufficientMemory : return( insu    
 82     case nfu_badIndex : return( badIndex_messa    
 83     case nfu_XNotAscending : return( XNotAscen    
 84     case nfu_badIndexForX : return( badIndexFo    
 85     case nfu_XOutsideDomain : return( XOutside    
 86     case nfu_invalidInterpolation : return( in    
 87     case nfu_badSelf : return( badSelf_message    
 88     case nfu_divByZero : return( divByZero_mes    
 89     case nfu_unsupportedInterpolation : return    
 90     case nfu_unsupportedInterpolationConversio    
 91     case nfu_empty : return( empty_message );     
 92     case nfu_tooFewPoints : return( tooFewPoin    
 93     case nfu_domainsNotMutual : return( notMut    
 94     case nfu_badInput : return( badInput_messa    
 95     case nfu_badNorm : return( badNorm_message    
 96     case nfu_badIntegrationInput : return( bad    
 97     case nfu_otherInterpolation : return( othe    
 98     case nfu_failedToConverge : return( failed    
 99     case nfu_oddNumberOfValues : return( oddNu    
100     }                                             
101     return( unknownStatus_message );              
102 }                                                 
103 /*                                                
104 **********************************************    
105 */                                                
106 void nfu_setMemoryDebugMode( int mode ) {         
107                                                   
108     nfu_debugging = mode;                         
109 }                                                 
110 /*                                                
111 **********************************************    
112 */                                                
113 void *nfu_malloc( size_t size ) {                 
114                                                   
115     void *p = malloc( size );                     
116                                                   
117     if( nfu_debugging ) printf( "nfu_malloc  %    
118     return( p );                                  
119 }                                                 
120 /*                                                
121 **********************************************    
122 */                                                
123 void *nfu_calloc( size_t size, size_t n ) {       
124                                                   
125     void *p = calloc( size, n );                  
126                                                   
127     if( nfu_debugging ) printf( "nfu_calloc  %    
128     return( p );                                  
129 }                                                 
130 /*                                                
131 **********************************************    
132 */                                                
133 void *nfu_realloc( size_t size, void *old ) {     
134                                                   
135     void *p = realloc( old, size );               
136                                                   
137     if( nfu_debugging ) printf( "nfu_realloc %    
138     return( p );                                  
139 }                                                 
140 /*                                                
141 **********************************************    
142 */                                                
143 void *nfu_free( void *p ) {                       
144                                                   
145     if( p != NULL ) {                             
146         if( nfu_debugging ) printf( "nfu_free     
147         free( p );                                
148     }                                             
149     return( NULL );                               
150 }                                                 
151 /*                                                
152 **********************************************    
153 */                                                
154 void nfu_printMsg( char *fmt, ... ) {             
155                                                   
156     va_list args;                                 
157                                                   
158     va_start( args, fmt );                        
159     vfprintf( stderr, fmt, args );                
160     fprintf( stderr, "\n" );                      
161     va_end( args );                               
162 }                                                 
163 /*                                                
164 **********************************************    
165 */                                                
166 void nfu_printErrorMsg( char *fmt, ... ) {        
167                                                   
168     va_list args;                                 
169                                                   
170     va_start( args, fmt );                        
171     vfprintf( stderr, fmt, args );                
172     fprintf( stderr, "\n" );                      
173     va_end( args );                               
174                                                   
175     exit( EXIT_FAILURE );                         
176 }                                                 
177                                                   
178 #if defined __cplusplus                           
179 }                                                 
180 #endif                                            
181