Import Geant4 10.5.1 source tree

This commit is contained in:
Gabriele Cosmo
2019-04-17 10:39:02 +02:00
parent a7fdc52004
commit 28a70706e0
661 changed files with 55791 additions and 106984 deletions
+8
View File
@@ -16,6 +16,14 @@ committal in the SVN repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
March 13, 2019 Gabriele Cosmo (global-V10-04-32)
- Enable FPE detection on MacOS with clang.
Addressing problem report #2147.
- Changed ID for release 10.5.p01.
January 31, 2019 Ivana Hrivnacova
- Merged GitHub PR #4: all Boolean operators now return G4bool.
November 26, 2018 Gabriele Cosmo (global-V10-04-31)
- G4Cache, G4CacheDetails: minor code cleanup and formatting.
+119 -111
View File
@@ -29,9 +29,9 @@
// -*- C++ -*-
//
// -----------------------------------------------------------------------
// This global method should be used on LINUX or MacOSX platforms with gcc
// compiler for activating NaN detection and FPE signals, and forcing
// abortion of the application at the time these are detected.
// This global method should be used on LINUX/gcc or MacOS/clang platforms
// for activating NaN detection and FPE signals, and forcing abortion of
// the application at the time these are detected.
// Meant to be used for debug purposes, can be activated by compiling the
// "run" module with the flag G4FPE_DEBUG set in the environment.
// -----------------------------------------------------------------------
@@ -42,104 +42,107 @@
#include <iostream>
#include <stdlib.h> /* abort(), exit() */
#if (defined(__GNUC__) && !defined(__clang__))
#ifdef __linux__
#include <features.h>
#include <fenv.h>
#include <csignal>
// for G4StackBacktrace()
#include <execinfo.h>
#include <cxxabi.h>
#if (defined(__GNUC__) && !defined(__clang__))
#include <features.h>
#include <fenv.h>
#include <csignal>
// for G4StackBacktrace()
#include <execinfo.h>
#include <cxxabi.h>
struct sigaction termaction, oldaction;
struct sigaction termaction, oldaction;
static void G4StackBackTrace()
{
// from http://linux.die.net/man/3/backtrace_symbols_fd
#define BSIZE 50
void * buffer[ BSIZE ];
int nptrs = backtrace( buffer, BSIZE );
//std::cerr << "nptrs=" << nptrs << std::endl;
char ** strings = backtrace_symbols( buffer, nptrs );
if ( strings == NULL ) {
perror( "backtrace_symbols" );
return;
}
std::cerr << std::endl<< "Call Stack:" << std::endl;
for ( int j = 0; j < nptrs; j++ ){
//printf("%s\n", strings[j]);
std::cerr << nptrs-j-1 <<": ";
//std::cerr << strings[j] << std::endl;
char * mangled_start = strchr( strings[j], '(' ) + 1;
if (mangled_start) *(mangled_start-1) = '\0';
char * mangled_end = strchr( mangled_start,'+' );
if ( mangled_end ) *mangled_end = '\0';
//std::cerr << "mangled .. " << mangled_start << ", len:" << strlen(mangled_start)<< std::endl;
int status = 0;
char *realname=0;
if ( mangled_end && strlen(mangled_start) )
realname = abi::__cxa_demangle( mangled_start, 0, 0, &status );
if ( realname ) {
std::cerr << strings[j]<< " : " << realname << std::endl;
free( realname );
} else {
std::cerr << strings[j] << std::endl;
}
}
free( strings );
// c++filt can demangle: http://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_demangling.html
//-------------------------------------------------------------
}
static void TerminationSignalHandler(int sig, siginfo_t* sinfo, void* /* context */)
{
std::cerr << "ERROR: " << sig;
std::string message = "Floating-point exception (FPE).";
if (sinfo) {
switch (sinfo->si_code) {
#ifdef FPE_NOOP /* BUG: MacOSX uses this instead of INTDIV */
case FPE_NOOP:
#endif
case FPE_INTDIV:
message = "Integer divide by zero.";
break;
case FPE_INTOVF:
message = "Integer overflow.";
break;
case FPE_FLTDIV:
message = "Floating point divide by zero.";
break;
case FPE_FLTOVF:
message = "Floating point overflow.";
break;
case FPE_FLTUND:
message = "Floating point underflow.";
break;
case FPE_FLTRES:
message = "Floating point inexact result.";
break;
case FPE_FLTINV:
message = "Floating point invalid operation.";
break;
case FPE_FLTSUB:
message = "Subscript out of range.";
break;
default:
message = "Unknown error.";
break;
static void G4StackBackTrace()
{
// from http://linux.die.net/man/3/backtrace_symbols_fd
#define BSIZE 50
void * buffer[ BSIZE ];
int nptrs = backtrace( buffer, BSIZE );
char ** strings = backtrace_symbols( buffer, nptrs );
if ( strings == NULL )
{
perror( "backtrace_symbols" );
return;
}
std::cerr << std::endl<< "Call Stack:" << std::endl;
for ( int j = 0; j < nptrs; j++ )
{
std::cerr << nptrs-j-1 <<": ";
char * mangled_start = strchr( strings[j], '(' ) + 1;
if (mangled_start) *(mangled_start-1) = '\0';
char * mangled_end = strchr( mangled_start,'+' );
if ( mangled_end ) *mangled_end = '\0';
int status = 0;
char *realname=0;
if ( mangled_end && strlen(mangled_start) )
realname = abi::__cxa_demangle( mangled_start, 0, 0, &status );
if ( realname )
{
std::cerr << strings[j]<< " : " << realname << std::endl;
free( realname );
}
else
{
std::cerr << strings[j] << std::endl;
}
}
free( strings );
// c++filt can demangle:
// http://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_demangling.html
//-------------------------------------------------------------------
}
std::cerr << " - " << message << std::endl;
G4StackBackTrace();
::abort();
}
static void TerminationSignalHandler(int sig, siginfo_t* sinfo,
void* /* context */)
{
std::cerr << "ERROR: " << sig;
std::string message = "Floating-point exception (FPE).";
static void InvalidOperationDetection()
{
std::cout << std::endl
if (sinfo)
{
switch (sinfo->si_code)
{
#ifdef FPE_NOOP /* BUG: MacOS uses this instead of INTDIV */
case FPE_NOOP:
#endif
case FPE_INTDIV:
message = "Integer divide by zero.";
break;
case FPE_INTOVF:
message = "Integer overflow.";
break;
case FPE_FLTDIV:
message = "Floating point divide by zero.";
break;
case FPE_FLTOVF:
message = "Floating point overflow.";
break;
case FPE_FLTUND:
message = "Floating point underflow.";
break;
case FPE_FLTRES:
message = "Floating point inexact result.";
break;
case FPE_FLTINV:
message = "Floating point invalid operation.";
break;
case FPE_FLTSUB:
message = "Subscript out of range.";
break;
default:
message = "Unknown error.";
break;
}
}
std::cerr << " - " << message << std::endl;
G4StackBackTrace();
::abort();
}
static void InvalidOperationDetection()
{
std::cout << std::endl
<< " "
<< "############################################" << std::endl
<< " "
@@ -147,19 +150,26 @@
<< " "
<< "############################################" << std::endl;
(void) feenableexcept( FE_DIVBYZERO );
(void) feenableexcept( FE_INVALID );
//(void) feenableexcept( FE_OVERFLOW );
//(void) feenableexcept( FE_UNDERFLOW );
(void) feenableexcept( FE_DIVBYZERO );
(void) feenableexcept( FE_INVALID );
//(void) feenableexcept( FE_OVERFLOW );
//(void) feenableexcept( FE_UNDERFLOW );
sigfillset(&termaction.sa_mask);
sigdelset(&termaction.sa_mask,SIGFPE);
termaction.sa_sigaction=TerminationSignalHandler;
termaction.sa_flags=SA_SIGINFO;
sigaction(SIGFPE, &termaction, &oldaction);
}
sigfillset(&termaction.sa_mask);
sigdelset(&termaction.sa_mask,SIGFPE);
termaction.sa_sigaction=TerminationSignalHandler;
termaction.sa_flags=SA_SIGINFO;
sigaction(SIGFPE, &termaction, &oldaction);
}
#else /* Not GCC */
static void InvalidOperationDetection() {;}
#endif
#elif defined(__MACH__) /* MacOS */
#elif defined(__MACH__) /* MacOSX */
#include <fenv.h>
#include <signal.h>
@@ -242,7 +252,7 @@
if (sinfo) {
switch (sinfo->si_code) {
#ifdef FPE_NOOP /* BUG: MacOSX uses this instead of INTDIV */
#ifdef FPE_NOOP /* BUG: MacOS uses this instead of INTDIV */
case FPE_NOOP:
#endif
case FPE_INTDIV:
@@ -303,13 +313,11 @@
termaction.sa_flags=SA_SIGINFO;
sigaction(SIGFPE, &termaction, &oldaction);
}
#else /* Not Linux, nor MacOSX ... */
#else /* Not Linux, nor MacOS ... */
static void InvalidOperationDetection() {;}
#endif /* Linus or MacOSX */
#else /* Not GCC */
#endif /* Linux or MacOS */
static void InvalidOperationDetection() {;}
#endif
#endif /* G4FPEDetection_h */
@@ -157,8 +157,8 @@ private:
inline G4double DerivativeXY(size_t idx, size_t idy, G4double fac) const;
// computation of derivatives
G4int operator==(const G4Physics2DVector &right) const = delete;
G4int operator!=(const G4Physics2DVector &right) const = delete;
G4bool operator==(const G4Physics2DVector &right) const = delete;
G4bool operator!=(const G4Physics2DVector &right) const = delete;
G4PhysicsVectorType type; // The type of PhysicsVector (enumerator)
@@ -102,8 +102,8 @@ class G4PhysicsVector
// Obsolete method to get value, isOutRange is not used anymore.
// This method is kept for the compatibility reason.
G4int operator==(const G4PhysicsVector &right) const ;
G4int operator!=(const G4PhysicsVector &right) const ;
G4bool operator==(const G4PhysicsVector &right) const ;
G4bool operator!=(const G4PhysicsVector &right) const ;
inline G4double operator[](const size_t index) const ;
// Returns the value for the specified index of the dataVector
@@ -109,8 +109,8 @@ class G4StateManager
G4StateManager();
G4StateManager(const G4StateManager &right);
G4StateManager& operator=(const G4StateManager &right);
G4int operator==(const G4StateManager &right) const;
G4int operator!=(const G4StateManager &right) const;
G4bool operator==(const G4StateManager &right) const;
G4bool operator!=(const G4StateManager &right) const;
private:
@@ -86,8 +86,8 @@ class G4UnitDefinition
public: // without description
~G4UnitDefinition();
G4int operator==(const G4UnitDefinition&) const;
G4int operator!=(const G4UnitDefinition&) const;
G4bool operator==(const G4UnitDefinition&) const;
G4bool operator!=(const G4UnitDefinition&) const;
public: // with description
@@ -141,8 +141,8 @@ class G4UnitsCategory
explicit G4UnitsCategory(const G4String& name);
~G4UnitsCategory();
G4int operator==(const G4UnitsCategory&) const;
G4int operator!=(const G4UnitsCategory&) const;
G4bool operator==(const G4UnitsCategory&) const;
G4bool operator!=(const G4UnitsCategory&) const;
public: // without description
@@ -58,8 +58,8 @@ public:
G4VExceptionHandler();
virtual ~G4VExceptionHandler();
G4int operator==(const G4VExceptionHandler &right) const;
G4int operator!=(const G4VExceptionHandler &right) const;
G4bool operator==(const G4VExceptionHandler &right) const;
G4bool operator!=(const G4VExceptionHandler &right) const;
public: // with description
@@ -58,8 +58,8 @@ public:
explicit G4VStateDependent(G4bool bottom=false);
virtual ~G4VStateDependent();
G4int operator==(const G4VStateDependent &right) const;
G4int operator!=(const G4VStateDependent &right) const;
G4bool operator==(const G4VStateDependent &right) const;
G4bool operator!=(const G4VStateDependent &right) const;
public: // with description
@@ -44,11 +44,11 @@
// |--> patch number
#ifndef G4VERSION_NUMBER
#define G4VERSION_NUMBER 1050
#define G4VERSION_NUMBER 1051
#endif
#ifndef G4VERSION_TAG
#define G4VERSION_TAG "$Name: geant4-10-05 $"
#define G4VERSION_TAG "$Name: geant4-10-05-patch-01 $"
#endif
// as variables
@@ -56,10 +56,10 @@
#include "G4String.hh"
#ifdef G4MULTITHREADED
static const G4String G4Version = "$Name: geant4-10-05 [MT]$";
static const G4String G4Version = "$Name: geant4-10-05-patch-01 [MT]$";
#else
static const G4String G4Version = "$Name: geant4-10-05 $";
static const G4String G4Version = "$Name: geant4-10-05-patch-01 $";
#endif
static const G4String G4Date = "(7-December-2018)";
static const G4String G4Date = "(17-April-2019)";
#endif
@@ -98,14 +98,14 @@ G4PhysicsVector& G4PhysicsVector::operator=(const G4PhysicsVector& right)
// --------------------------------------------------------------
G4int G4PhysicsVector::operator==(const G4PhysicsVector &right) const
G4bool G4PhysicsVector::operator==(const G4PhysicsVector &right) const
{
return (this == &right);
}
// --------------------------------------------------------------
G4int G4PhysicsVector::operator!=(const G4PhysicsVector &right) const
G4bool G4PhysicsVector::operator!=(const G4PhysicsVector &right) const
{
return (this != &right);
}
@@ -114,13 +114,13 @@ G4StateManager::operator=(const G4StateManager &right)
return *this;
}
G4int
G4bool
G4StateManager::operator==(const G4StateManager &right) const
{
return (this == &right);
}
G4int
G4bool
G4StateManager::operator!=(const G4StateManager &right) const
{
return (this != &right);
+4 -4
View File
@@ -139,14 +139,14 @@ G4UnitDefinition& G4UnitDefinition::operator=(const G4UnitDefinition& right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4UnitDefinition::operator==(const G4UnitDefinition& right) const
G4bool G4UnitDefinition::operator==(const G4UnitDefinition& right) const
{
return (this == (G4UnitDefinition *) &right);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4UnitDefinition::operator!=(const G4UnitDefinition &right) const
G4bool G4UnitDefinition::operator!=(const G4UnitDefinition &right) const
{
return (this != (G4UnitDefinition *) &right);
}
@@ -457,14 +457,14 @@ G4UnitsCategory& G4UnitsCategory::operator=(const G4UnitsCategory& right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4UnitsCategory::operator==(const G4UnitsCategory& right) const
G4bool G4UnitsCategory::operator==(const G4UnitsCategory& right) const
{
return (this == (G4UnitsCategory *) &right);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4UnitsCategory::operator!=(const G4UnitsCategory &right) const
G4bool G4UnitsCategory::operator!=(const G4UnitsCategory &right) const
{
return (this != (G4UnitsCategory *) &right);
}
@@ -58,12 +58,12 @@ G4VExceptionHandler& G4VExceptionHandler::operator=(const G4VExceptionHandler &r
return *this;
}
G4int G4VExceptionHandler::operator==(const G4VExceptionHandler &right) const
G4bool G4VExceptionHandler::operator==(const G4VExceptionHandler &right) const
{
return (this == &right);
}
G4int G4VExceptionHandler::operator!=(const G4VExceptionHandler &right) const
G4bool G4VExceptionHandler::operator!=(const G4VExceptionHandler &right) const
{
return (this != &right);
}
@@ -60,12 +60,12 @@ G4VStateDependent& G4VStateDependent::operator=(const G4VStateDependent &right)
return *this;
}
G4int G4VStateDependent::operator==(const G4VStateDependent &right) const
G4bool G4VStateDependent::operator==(const G4VStateDependent &right) const
{
return (this == &right);
}
G4int G4VStateDependent::operator!=(const G4VStateDependent &right) const
G4bool G4VStateDependent::operator!=(const G4VStateDependent &right) const
{
return (this != &right);
}