ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
tree
geant4-10.6-release
config
environments
examples
source
analysis
digits_hits
error_propagation
event
externals
g3tog4
geometry
global
graphics_reps
intercoms
interfaces
materials
parameterisations
particles
persistency
physics_lists
processes
biasing
cuts
decay
electromagnetic
hadronic
cross_sections
management
models
abla
abrasion
binary_cascade
cascade
coherent_elastic
de_excitation
em_dissociation
fission
gamma_nuclear
im_r_matrix
inclxx
lend
include
src
G4GIDI.cc
G4GIDI_map.cc
G4GIDI_mass.cc
G4GIDI_Misc.cc
G4GIDI_target.cc
G4LENDCapture.cc
G4LENDCaptureCrossSection.cc
G4LENDCombinedCrossSection.cc
G4LENDCombinedModel.cc
G4LENDCrossSection.cc
G4LENDElastic.cc
G4LENDElasticCrossSection.cc
G4LENDFission.cc
G4LENDFissionCrossSection.cc
G4LENDGammaCrossSection.cc
G4LENDGammaModel.cc
G4LENDInelastic.cc
G4LENDInelasticCrossSection.cc
G4LENDManager.cc
G4LENDModel.cc
G4LENDUsedTarget.cc
GIDI_settings.cc
GIDI_settings_flux.cc
GIDI_settings_group.cc
GIDI_settings_particle.cc
lPoPs.cc
MCGIDI_angular.cc
MCGIDI_angularEnergy.cc
MCGIDI_distribution.cc
MCGIDI_energy.cc
MCGIDI_energyAngular.cc
MCGIDI_fromTOM.cc
MCGIDI_KalbachMann.cc
MCGIDI_kinetics.cc
MCGIDI_LLNLAngular_angularEnergy.cc
MCGIDI_map.cc
MCGIDI_mass.cc
MCGIDI_misc.cc
MCGIDI_outputChannel.cc
MCGIDI_particle.cc
MCGIDI_pop.cc
MCGIDI_product.cc
MCGIDI_quantitiesLookupMode.cc
MCGIDI_reaction.cc
MCGIDI_sampling.cc
MCGIDI_samplingSettings.cc
MCGIDI_target.cc
MCGIDI_target_heated.cc
MCGIDI_uncorrelated.cc
MCGIDI_version.cc
nf_angularMomentumCoupling.cc
nf_exponentialIntegral.cc
nf_gammaFunctions.cc
nf_GnG_adaptiveQuadrature.cc
nf_incompleteGammaFunctions.cc
nf_Legendre.cc
nf_Legendre_GaussianQuadrature.cc
nf_polevl.cc
nf_stringToDoubles.cc
nf_stringToDoubles_main.cc
nf_utilities.cc
PoPs.cc
PoPs_Bcast.cc
PoPs_data.cc
PoPs_mass.cc
ptwX_core.cc
ptwX_misc.cc
ptwXY_binaryOperators.cc
ptwXY_convenient.cc
ptwXY_core.cc
ptwXY_functions.cc
ptwXY_integration.cc
ptwXY_interpolation.cc
ptwXY_methods.cc
ptwXY_misc.cc
ptwXY_unitaryOperators.cc
statusMessageReporting.cc
xDataTOM.cc
xDataTOM_axes.cc
xDataTOM_importXML.cc
xDataTOM_importXML_axes.cc
xDataTOM_importXML_KalbachMann.cc
xDataTOM_importXML_polynomial.cc
xDataTOM_importXML_regionsW_XYs_LegendreSeries.cc
xDataTOM_importXML_regionsXYs.cc
xDataTOM_importXML_V_W_XYs.cc
xDataTOM_importXML_V_W_XYs_LegendreSeries.cc
xDataTOM_importXML_W_XYs.cc
xDataTOM_importXML_W_XYs_LegendreSeries.cc
xDataTOM_importXML_XYs.cc
xDataTOM_interpolation.cc
xDataTOM_KalbachMann.cc
xDataTOM_LegendreSeries.cc
xDataTOM_Misc.cc
xDataTOM_polynomial.cc
xDataTOM_regionsW_XYs_LegendreSeries.cc
xDataTOM_regionsXYs.cc
xDataTOM_V_W_XYs.cc
xDataTOM_V_W_XYs_LegendreSeries.cc
xDataTOM_W_XYs.cc
xDataTOM_W_XYs_LegendreSeries.cc
xDataTOM_XYs.cc
lepto_nuclear
management
particle_hp
parton_string
pre_equilibrium
qmd
quasi_elastic
radioactive_decay
rpg
theo_high_energy
util
processes
stopping
util
management
optical
parameterisation
scoring
solidstate
transportation
readout
run
track
tracking
visualization
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
nf_utilities.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file nf_utilities.cc
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 okay"
;
27
static
const
char
mallocError_message
[] =
"could not allocate memory"
;
28
static
const
char
insufficientMemory_message
[] =
"user's memory is too small to hanlde data"
;
29
static
const
char
badIndex_message
[] =
"bad index"
;
30
static
const
char
XNotAscending_message
[] =
"x values are not ascending"
;
31
static
const
char
badIndexForX_message
[] =
"index not correct for x value"
;
32
static
const
char
XOutsideDomain_message
[] =
"x value not in domain"
;
33
static
const
char
invalidInterpolation_message
[] =
"bad x,y values for interpolation"
;
34
static
const
char
badSelf_message
[] =
"source object has bad status value"
;
35
static
const
char
divByZero_message
[] =
"division by zero"
;
36
static
const
char
unsupportedInterpolation_message
[] =
"unsupported interpolation"
;
37
static
const
char
unsupportedInterpolationConversion_message
[] =
"unsupported interpolation conversion"
;
38
static
const
char
empty_message
[] =
"empty instance"
;
39
static
const
char
tooFewPoints_message
[] =
"too few points in instance"
;
40
static
const
char
notMutualDomian_message
[] =
"domains are not mutual"
;
41
static
const
char
unknownStatus_message
[] =
"unknown (i.e., invalid) status value"
;
42
static
const
char
badInput_message
[] =
"bad input to function"
;
43
static
const
char
badNorm_message
[] =
"bad norm"
;
44
static
const
char
badIntegrationInput_message
[] =
"bad integration input"
;
45
static
const
char
otherInterpolation_message
[] =
"other integration not supported"
;
46
static
const
char
failedToConverge_message
[] =
"failed to converge"
;
47
static
const
char
oddNumberOfValues_message
[] =
"odd number of inputted values"
;
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
status ) {
77
78
switch
( status ) {
79
case
nfu_Okay
:
return
(
Okay_message
);
80
case
nfu_mallocError
:
return
(
mallocError_message
);
81
case
nfu_insufficientMemory
:
return
(
insufficientMemory_message
);
82
case
nfu_badIndex
:
return
(
badIndex_message
);
83
case
nfu_XNotAscending
:
return
(
XNotAscending_message
);
84
case
nfu_badIndexForX
:
return
(
badIndexForX_message
);
85
case
nfu_XOutsideDomain
:
return
(
XOutsideDomain_message
);
86
case
nfu_invalidInterpolation
:
return
(
invalidInterpolation_message
);
87
case
nfu_badSelf
:
return
(
badSelf_message
);
88
case
nfu_divByZero
:
return
(
divByZero_message
);
89
case
nfu_unsupportedInterpolation
:
return
(
unsupportedInterpolation_message
);
90
case
nfu_unsupportedInterpolationConversion
:
return
(
unsupportedInterpolationConversion_message
);
91
case
nfu_empty
:
return
(
empty_message
);
92
case
nfu_tooFewPoints
:
return
(
tooFewPoints_message
);
93
case
nfu_domainsNotMutual
:
return
(
notMutualDomian_message
);
94
case
nfu_badInput
:
return
(
badInput_message
);
95
case
nfu_badNorm
:
return
(
badNorm_message
);
96
case
nfu_badIntegrationInput
:
return
(
badIntegrationInput_message
);
97
case
nfu_otherInterpolation
:
return
(
otherInterpolation_message
);
98
case
nfu_failedToConverge
:
return
(
failedToConverge_message
);
99
case
nfu_oddNumberOfValues
:
return
(
oddNumberOfValues_message
);
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 %12p size = %8llu\n"
, p, (
long
long
unsigned
) size );
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 %12p size = %8llu, n = %8llu\n"
, p, (
long
long
unsigned
) size, (
long
long
unsigned
) n );
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 %12p size = %8llu, old = %12p\n"
, p, (
long
long
unsigned
) size, old );
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 %12p\n"
, p );
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
geant4
tree
geant4-10.6-release
source
processes
hadronic
models
lend
src
nf_utilities.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:46
using
1.8.2 with
ECCE GitHub integration