Import Geant4 11.4.0.beta source tree
This commit is contained in:
@@ -64,7 +64,7 @@
|
||||
#else
|
||||
|
||||
# include "G4Types.hh"
|
||||
|
||||
# include "G4IEEE754.hh"
|
||||
# include <cstdint>
|
||||
# include <limits>
|
||||
|
||||
@@ -97,54 +97,6 @@ namespace G4ExpConsts
|
||||
|
||||
const G4float LOG2EF = 1.44269504088896341f;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Used to switch between different type of interpretations of the data
|
||||
// (64 bits)
|
||||
//
|
||||
union ieee754
|
||||
{
|
||||
ieee754()= default;
|
||||
ieee754(G4double thed) { d = thed; };
|
||||
ieee754(uint64_t thell) { ll = thell; };
|
||||
ieee754(G4float thef) { f[0] = thef; };
|
||||
ieee754(uint32_t thei) { i[0] = thei; };
|
||||
G4double d;
|
||||
G4float f[2];
|
||||
uint32_t i[2];
|
||||
uint64_t ll;
|
||||
uint16_t s[4];
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts an unsigned long long to a double
|
||||
//
|
||||
inline G4double uint642dp(uint64_t ll)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.ll = ll;
|
||||
return tmp.d;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts an int to a float
|
||||
//
|
||||
inline G4float uint322sp(G4int x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.i[0] = x;
|
||||
return tmp.f[0];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts a float to an int
|
||||
//
|
||||
inline uint32_t sp2uint32(G4float x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.f[0] = x;
|
||||
return tmp.i[0];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/**
|
||||
* A vectorisable floor implementation, not only triggered by fast-math.
|
||||
@@ -156,7 +108,7 @@ namespace G4ExpConsts
|
||||
// no problem since exp is defined between -708 and 708. Int is enough for
|
||||
// it!
|
||||
int32_t ret = int32_t(x);
|
||||
ret -= (sp2uint32(x) >> 31);
|
||||
ret -= (G4IEEE754::sp2uint32(x) >> 31);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -169,7 +121,7 @@ namespace G4ExpConsts
|
||||
inline G4float fpfloor(const G4float x)
|
||||
{
|
||||
int32_t ret = int32_t(x);
|
||||
ret -= (sp2uint32(x) >> 31);
|
||||
ret -= (G4IEEE754::sp2uint32(x) >> 31);
|
||||
return ret;
|
||||
}
|
||||
} // namespace G4ExpConsts
|
||||
@@ -211,7 +163,7 @@ inline G4double G4Exp(G4double initial_x)
|
||||
x = 1.0 + 2.0 * x;
|
||||
|
||||
// Build 2^n in double.
|
||||
x *= G4ExpConsts::uint642dp((((uint64_t) n) + 1023) << 52);
|
||||
x *= G4IEEE754::uint642dp((((uint64_t) n) + 1023) << 52);
|
||||
|
||||
if(initial_x > G4ExpConsts::EXP_LIMIT)
|
||||
x = std::numeric_limits<G4double>::infinity();
|
||||
@@ -252,7 +204,7 @@ inline G4float G4Expf(G4float initial_x)
|
||||
z += x + 1.0f;
|
||||
|
||||
/* multiply by power of 2 */
|
||||
z *= G4ExpConsts::uint322sp((n + 0x7f) << 23);
|
||||
z *= G4IEEE754::uint322sp((n + 0x7f) << 23);
|
||||
|
||||
if(initial_x > G4ExpConsts::MAXLOGF)
|
||||
z = std::numeric_limits<G4float>::infinity();
|
||||
@@ -262,17 +214,6 @@ inline G4float G4Expf(G4float initial_x)
|
||||
return z;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void expv(const uint32_t size, G4double const* __restrict__ iarray,
|
||||
G4double* __restrict__ oarray);
|
||||
void G4Expv(const uint32_t size, G4double const* __restrict__ iarray,
|
||||
G4double* __restrict__ oarray);
|
||||
void expfv(const uint32_t size, G4float const* __restrict__ iarray,
|
||||
G4float* __restrict__ oarray);
|
||||
void G4Expfv(const uint32_t size, G4float const* __restrict__ iarray,
|
||||
G4float* __restrict__ oarray);
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef G4IEEE754_hh
|
||||
#define G4IEEE754_hh 1
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace G4IEEE754
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
// Used to switch between different type of interpretations of the data
|
||||
// (64 bits)
|
||||
//
|
||||
union ieee754
|
||||
{
|
||||
ieee754() = default;
|
||||
ieee754(G4double thed) { d = thed; };
|
||||
ieee754(uint64_t thell) { ll = thell; };
|
||||
ieee754(G4float thef) { f[0] = thef; };
|
||||
ieee754(uint32_t thei) { i[0] = thei; };
|
||||
G4double d;
|
||||
G4float f[2];
|
||||
uint32_t i[2];
|
||||
uint64_t ll;
|
||||
uint16_t s[4];
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts a double to an unsigned long long
|
||||
//
|
||||
inline uint64_t dp2uint64(G4double x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.d = x;
|
||||
return tmp.ll;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts an unsigned long long to a double
|
||||
//
|
||||
inline G4double uint642dp(uint64_t ll)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.ll = ll;
|
||||
return tmp.d;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts an int to a float
|
||||
//
|
||||
inline G4float uint322sp(G4int x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.i[0] = x;
|
||||
return tmp.f[0];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts a float to an int
|
||||
//
|
||||
inline uint32_t sp2uint32(G4float x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.f[0] = x;
|
||||
return tmp.i[0];
|
||||
}
|
||||
} // namespace G4IEEE754
|
||||
|
||||
#endif
|
||||
@@ -64,7 +64,7 @@
|
||||
#else
|
||||
|
||||
# include "G4Types.hh"
|
||||
|
||||
# include "G4IEEE754.hh"
|
||||
# include <cstdint>
|
||||
# include <limits>
|
||||
|
||||
@@ -78,24 +78,6 @@ namespace G4LogConsts
|
||||
const G4double SQRTH = 0.70710678118654752440;
|
||||
const G4float MAXNUMF = 3.4028234663852885981170418348451692544e38f;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Used to switch between different type of interpretations of the data
|
||||
// (64 bits)
|
||||
//
|
||||
union ieee754
|
||||
{
|
||||
ieee754()= default;
|
||||
ieee754(G4double thed) { d = thed; };
|
||||
ieee754(uint64_t thell) { ll = thell; };
|
||||
ieee754(G4float thef) { f[0] = thef; };
|
||||
ieee754(uint32_t thei) { i[0] = thei; };
|
||||
G4double d;
|
||||
G4float f[2];
|
||||
uint32_t i[2];
|
||||
uint64_t ll;
|
||||
uint16_t s[4];
|
||||
};
|
||||
|
||||
inline G4double get_log_px(const G4double x)
|
||||
{
|
||||
const G4double PX1log = 1.01875663804580931796E-4;
|
||||
@@ -140,51 +122,11 @@ namespace G4LogConsts
|
||||
return qx;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts a double to an unsigned long long
|
||||
//
|
||||
inline uint64_t dp2uint64(G4double x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.d = x;
|
||||
return tmp.ll;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts an unsigned long long to a double
|
||||
//
|
||||
inline G4double uint642dp(uint64_t ll)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.ll = ll;
|
||||
return tmp.d;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts an int to a float
|
||||
//
|
||||
inline G4float uint322sp(G4int x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.i[0] = x;
|
||||
return tmp.f[0];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Converts a float to an int
|
||||
//
|
||||
inline uint32_t sp2uint32(G4float x)
|
||||
{
|
||||
ieee754 tmp;
|
||||
tmp.f[0] = x;
|
||||
return tmp.i[0];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// Like frexp but vectorising and the exponent is a double.
|
||||
inline G4double getMantExponent(const G4double x, G4double& fe)
|
||||
{
|
||||
uint64_t n = dp2uint64(x);
|
||||
uint64_t n = G4IEEE754::dp2uint64(x);
|
||||
|
||||
// Shift to the right up to the beginning of the exponent.
|
||||
// Then with a mask, cut off the sign bit
|
||||
@@ -202,14 +144,14 @@ namespace G4LogConsts
|
||||
const uint64_t p05 = 0x3FE0000000000000ULL; // dp2uint64(0.5);
|
||||
n |= p05;
|
||||
|
||||
return uint642dp(n);
|
||||
return G4IEEE754::uint642dp(n);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// Like frexp but vectorising and the exponent is a float.
|
||||
inline G4float getMantExponentf(const G4float x, G4float& fe)
|
||||
{
|
||||
uint32_t n = sp2uint32(x);
|
||||
uint32_t n = G4IEEE754::sp2uint32(x);
|
||||
int32_t e = (n >> 23) - 127;
|
||||
fe = e;
|
||||
|
||||
@@ -218,7 +160,7 @@ namespace G4LogConsts
|
||||
n &= 0x807fffff; // ~0x7f800000;
|
||||
n |= p05f;
|
||||
|
||||
return uint322sp(n);
|
||||
return G4IEEE754::uint322sp(n);
|
||||
}
|
||||
} // namespace G4LogConsts
|
||||
|
||||
@@ -335,17 +277,6 @@ inline G4float G4Logf(G4float x)
|
||||
return res;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void logv(const uint32_t size, G4double const* __restrict__ iarray,
|
||||
G4double* __restrict__ oarray);
|
||||
void G4Logv(const uint32_t size, G4double const* __restrict__ iarray,
|
||||
G4double* __restrict__ oarray);
|
||||
void logfv(const uint32_t size, G4float const* __restrict__ iarray,
|
||||
G4float* __restrict__ oarray);
|
||||
void G4Logfv(const uint32_t size, G4float const* __restrict__ iarray,
|
||||
G4float* __restrict__ oarray);
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif /* LOG_H_ */
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
/// |--> patch number (single digit)
|
||||
///
|
||||
#ifndef G4VERSION_NUMBER
|
||||
#define G4VERSION_NUMBER 1132
|
||||
#define G4VERSION_NUMBER 1140
|
||||
#endif
|
||||
|
||||
/// @def G4VERSION_REFERENCE_TAG
|
||||
@@ -55,11 +55,11 @@
|
||||
/// (taking December as 0, the start of new development of the next major/minor release).
|
||||
///
|
||||
#ifndef G4VERSION_REFERENCE_TAG
|
||||
#define G4VERSION_REFERENCE_TAG -1
|
||||
#define G4VERSION_REFERENCE_TAG 00
|
||||
#endif
|
||||
|
||||
#ifndef G4VERSION_TAG
|
||||
#define G4VERSION_TAG "$Name: geant4-11-03-patch-02 $"
|
||||
#define G4VERSION_TAG "$Name: geant4-11-04-beta-01 $"
|
||||
#endif
|
||||
|
||||
// as variables
|
||||
@@ -68,10 +68,10 @@
|
||||
#include "G4Types.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
static const G4String G4Version = "$Name: geant4-11-03-patch-02 [MT]$";
|
||||
static const G4String G4Version = "$Name: geant4-11-04-beta-01 [MT]$";
|
||||
#else
|
||||
static const G4String G4Version = "$Name: geant4-11-03-patch-02 $";
|
||||
static const G4String G4Version = "$Name: geant4-11-04-beta-01 $";
|
||||
#endif
|
||||
static const G4String G4Date = "(25-April-2025)";
|
||||
static const G4String G4Date = "(26-June-2025)";
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user