Import Geant4 7.0.0 source tree
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LorentzRotation.hh,v 1.3 2001/07/11 10:00:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef G4LorentzRotation_hh
|
||||
#define G4LorentzRotation_hh
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LorentzVector.hh,v 1.3 2001/07/11 10:00:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef G4LorentzVector_hh
|
||||
#define G4LorentzVector_hh
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Normal3D.hh,v 1.3 2001/07/11 10:00:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef G4NORMAL3D_HH
|
||||
#define G4NORMAL3D_HH
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Plane3D.hh,v 1.3 2001/07/11 10:00:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef G4PLANE3D_HH
|
||||
#define G4PLANE3D_HH
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Point3D.hh,v 1.3 2001/07/11 10:00:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef G4POINT3D_HH
|
||||
#define G4POINT3D_HH
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Transform3D.hh,v 1.3 2001/07/11 10:00:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef G4TRANSFORM3D_HH
|
||||
#define G4TRANSFORM3D_HH
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Vector3D.hh,v 1.3 2001/07/11 10:00:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef G4VECTOR3D_HH
|
||||
#define G4VECTOR3D_HH
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: geomdefs.hh,v 1.5 2002/05/15 09:32:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ChebyshevApproximation.hh,v 1.4 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DataInterpolation.hh,v 1.4 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussChebyshevQ.hh,v 1.4 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussHermiteQ.hh,v 1.4 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4GaussHermiteQ.hh,v 1.5 2004/11/12 17:38:20 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
@@ -41,7 +41,7 @@
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Gauss-Hermite method for integration of exp(-x*x)*nFunction(x) from minus infinity
|
||||
// Gauss-Hermite method for integration of std::exp(-x*x)*nFunction(x) from minus infinity
|
||||
// to plus infinity .
|
||||
//
|
||||
// G4double Integral() const
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussJacobiQ.hh,v 1.4 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussLaguerreQ.hh,v 1.4 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4GaussLaguerreQ.hh,v 1.5 2004/11/12 17:38:29 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
@@ -36,7 +36,7 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// Constructor for Gauss-Laguerre quadrature method: integral from zero to
|
||||
// infinity of pow(x,alpha)*exp(-x)*f(x). The value of nLaguerre sets the accuracy.
|
||||
// infinity of std::pow(x,alpha)*std::exp(-x)*f(x). The value of nLaguerre sets the accuracy.
|
||||
// The constructor creates arrays fAbscissa[0,..,nLaguerre-1] and
|
||||
// fWeight[0,..,nLaguerre-1] . The function GaussLaguerre(f) should be called
|
||||
// then with any f .
|
||||
@@ -48,7 +48,7 @@
|
||||
//
|
||||
// -------------------------------------------------------------------------
|
||||
//
|
||||
// Gauss-Laguerre method for integration of pow(x,alpha)*exp(-x)*pFunction(x)
|
||||
// Gauss-Laguerre method for integration of std::pow(x,alpha)*std::exp(-x)*pFunction(x)
|
||||
// from zero up to infinity. pFunction is evaluated in fNumber points for which
|
||||
// fAbscissa[i] and fWeight[i] arrays were created in constructor
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussLegendreQ.hh,v 1.4 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Integrator.hh,v 1.5 2001/07/11 10:00:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4Integrator.hh,v 1.6 2004/11/12 16:25:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
@@ -39,8 +39,8 @@
|
||||
#ifndef G4INTEGRATOR_HH
|
||||
#define G4INTEGRATOR_HH 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include <math.h>
|
||||
#include "G4Types.hh"
|
||||
#include <cmath>
|
||||
|
||||
template <class T, class F>
|
||||
class G4Integrator
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PolynomialSolver.hh,v 1.3 2001/07/11 10:00:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// class G4PolynomialSolver
|
||||
//
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PolynomialSolver.icc,v 1.6 2001/07/11 10:00:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4PolynomialSolver.icc,v 1.7 2004/11/12 17:38:29 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// class G4PolynomialSolver
|
||||
//
|
||||
@@ -100,7 +100,7 @@ G4PolynomialSolver<T,F>::BezierClipping(/*T* typeF,F func,F deriv,*/
|
||||
P[0][1] = (FunctionClass->*Function)(*IntervalMin);
|
||||
|
||||
|
||||
if (fabs(P[0][1]) < Precision) {
|
||||
if (std::fabs(P[0][1]) < Precision) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ G4double G4PolynomialSolver<T,F>::Newton (G4double IntervalMin,
|
||||
Value = (FunctionClass->*Function)(Lambda);
|
||||
|
||||
|
||||
// while ((fabs(Value) > Precision)) {
|
||||
// while ((std::fabs(Value) > Precision)) {
|
||||
while (j != -1) {
|
||||
|
||||
Value = (FunctionClass->*Function)(Lambda);
|
||||
@@ -201,7 +201,7 @@ G4double G4PolynomialSolver<T,F>::Newton (G4double IntervalMin,
|
||||
|
||||
Lambda = Lambda - Value/Gradient ;
|
||||
|
||||
if (fabs(Value) <= Precision) {
|
||||
if (std::fabs(Value) <= Precision) {
|
||||
j ++;
|
||||
if (j == 2) {
|
||||
j = -1;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleIntegration.hh,v 1.3 2001/07/11 10:00:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4SimpleIntegration.hh,v 1.4 2004/11/12 16:25:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
@@ -55,7 +55,7 @@
|
||||
#ifndef G4SIMPLEINTEGRATION_HH
|
||||
#define G4SIMPLEINTEGRATION_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Types.hh"
|
||||
|
||||
typedef G4double (*function)(G4double) ;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VGaussianQuadrature.hh,v 1.4 2001/07/11 10:00:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4VGaussianQuadrature.hh,v 1.5 2004/11/12 17:38:29 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
@@ -44,7 +44,7 @@
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// Auxiliary function which returns the value of log(gamma-function(x))
|
||||
// Auxiliary function which returns the value of std::log(gamma-function(x))
|
||||
//
|
||||
// G4double
|
||||
// GammaLogarithm(G4double xx)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ChebyshevApproximation.cc,v 1.3 2001/07/11 10:00:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4ChebyshevApproximation.cc,v 1.4 2004/11/12 17:38:32 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
|
||||
#include "G4ChebyshevApproximation.hh"
|
||||
@@ -55,7 +55,7 @@ G4ChebyshevApproximation::G4ChebyshevApproximation( function pFunction,
|
||||
|
||||
for (i=0;i<fNumber;i++)
|
||||
{
|
||||
rootSum = cos(cof*(i+0.5)) ;
|
||||
rootSum = std::cos(cof*(i+0.5)) ;
|
||||
tempFunction[i]= fFunction(rootSum*fDiff+fMean) ;
|
||||
}
|
||||
for (j=0;j<fNumber;j++)
|
||||
@@ -65,7 +65,7 @@ G4ChebyshevApproximation::G4ChebyshevApproximation( function pFunction,
|
||||
|
||||
for (i=0;i<fNumber;i++)
|
||||
{
|
||||
rootSum += tempFunction[i]*cos(cofj*(i+0.5)) ;
|
||||
rootSum += tempFunction[i]*std::cos(cofj*(i+0.5)) ;
|
||||
}
|
||||
fChebyshevCof[j] = weight*rootSum ;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ G4ChebyshevApproximation( function pFunction,
|
||||
|
||||
for (i=0;i<fNumber;i++)
|
||||
{
|
||||
rootSum = cos(cof*(i+0.5)) ;
|
||||
rootSum = std::cos(cof*(i+0.5)) ;
|
||||
tempFunction[i] = fFunction(rootSum*fDiff+fMean) ;
|
||||
}
|
||||
for (j=0;j<fNumber;j++)
|
||||
@@ -118,7 +118,7 @@ G4ChebyshevApproximation( function pFunction,
|
||||
|
||||
for (i=0;i<fNumber;i++)
|
||||
{
|
||||
rootSum += tempFunction[i]*cos(cofj*(i+0.5)) ;
|
||||
rootSum += tempFunction[i]*std::cos(cofj*(i+0.5)) ;
|
||||
}
|
||||
fChebyshevCof[j] = weight*rootSum ; // corresponds to pFunction
|
||||
}
|
||||
@@ -162,7 +162,7 @@ G4ChebyshevApproximation::G4ChebyshevApproximation( function pFunction,
|
||||
|
||||
for (i=0;i<fNumber;i++)
|
||||
{
|
||||
rootSum = cos(cof*(i+0.5)) ;
|
||||
rootSum = std::cos(cof*(i+0.5)) ;
|
||||
tempFunction[i]= fFunction(rootSum*fDiff+fMean) ;
|
||||
}
|
||||
for (j=0;j<fNumber;j++)
|
||||
@@ -172,7 +172,7 @@ G4ChebyshevApproximation::G4ChebyshevApproximation( function pFunction,
|
||||
|
||||
for (i=0;i<fNumber;i++)
|
||||
{
|
||||
rootSum += tempFunction[i]*cos(cofj*(i+0.5)) ;
|
||||
rootSum += tempFunction[i]*std::cos(cofj*(i+0.5)) ;
|
||||
}
|
||||
fChebyshevCof[j] = weight*rootSum ; // corresponds to pFunction
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DataInterpolation.cc,v 1.5 2004/04/23 06:52:57 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// $Id: G4DataInterpolation.cc,v 1.6 2004/11/12 17:38:32 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
#include "G4DataInterpolation.hh"
|
||||
|
||||
@@ -149,10 +149,10 @@ G4DataInterpolation::PolynomInterpolation(G4double pX,
|
||||
G4double mult, diff, difi, deltaLow, deltaUp, cd, y ;
|
||||
G4double* c = new G4double[fNumber] ;
|
||||
G4double* d = new G4double[fNumber] ;
|
||||
diff = fabs(pX-fArgument[0]) ;
|
||||
diff = std::fabs(pX-fArgument[0]) ;
|
||||
for(i=0;i<fNumber;i++)
|
||||
{
|
||||
difi = fabs(pX-fArgument[i]) ;
|
||||
difi = std::fabs(pX-fArgument[i]) ;
|
||||
if(difi <diff)
|
||||
{
|
||||
k = i ;
|
||||
@@ -253,10 +253,10 @@ G4DataInterpolation::RationalPolInterpolation(G4double pX,
|
||||
G4double mult, difi, diff, cd, y, cof ;
|
||||
G4double* c = new G4double[fNumber] ;
|
||||
G4double* d = new G4double[fNumber] ;
|
||||
diff = fabs(pX-fArgument[0]) ;
|
||||
diff = std::fabs(pX-fArgument[0]) ;
|
||||
for(i=0;i<fNumber;i++)
|
||||
{
|
||||
difi = fabs(pX-fArgument[i]) ;
|
||||
difi = std::fabs(pX-fArgument[i]) ;
|
||||
if(difi == 0.0)
|
||||
{
|
||||
y = fFunction[i] ;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussChebyshevQ.cc,v 1.3 2001/07/11 10:00:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4GaussChebyshevQ.cc,v 1.4 2004/11/12 17:38:32 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
#include "G4GaussChebyshevQ.hh"
|
||||
|
||||
@@ -41,8 +41,8 @@ G4GaussChebyshevQ::G4GaussChebyshevQ( function pFunction ,
|
||||
fWeight = new G4double[fNumber] ;
|
||||
for(i=0;i<fNumber;i++)
|
||||
{
|
||||
fAbscissa[i] = cos(cof*(i + 0.5)) ;
|
||||
fWeight[i] = cof*sqrt(1 - fAbscissa[i]*fAbscissa[i]) ;
|
||||
fAbscissa[i] = std::cos(cof*(i + 0.5)) ;
|
||||
fWeight[i] = cof*std::sqrt(1 - fAbscissa[i]*fAbscissa[i]) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussHermiteQ.cc,v 1.4 2001/07/11 10:00:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4GaussHermiteQ.cc,v 1.5 2004/11/12 17:38:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
#include "G4GaussHermiteQ.hh"
|
||||
|
||||
@@ -41,7 +41,7 @@ G4GaussHermiteQ::G4GaussHermiteQ( function pFunction,
|
||||
G4int i, j, k ;
|
||||
G4double newton=0.;
|
||||
G4double newton1, temp1, temp2, temp3, temp ;
|
||||
G4double piInMinusQ = pow(pi,-0.25) ; // 1.0/sqrt(sqrt(pi)) ??
|
||||
G4double piInMinusQ = std::pow(pi,-0.25) ; // 1.0/std::sqrt(std::sqrt(pi)) ??
|
||||
|
||||
fNumber = (nHermite +1)/2 ;
|
||||
fAbscissa = new G4double[fNumber] ;
|
||||
@@ -51,12 +51,12 @@ G4GaussHermiteQ::G4GaussHermiteQ( function pFunction,
|
||||
{
|
||||
if(i == 1)
|
||||
{
|
||||
newton = sqrt((G4double)(2*nHermite + 1)) -
|
||||
1.85575001*pow((G4double)(2*nHermite + 1),-0.16666999) ;
|
||||
newton = std::sqrt((G4double)(2*nHermite + 1)) -
|
||||
1.85575001*std::pow((G4double)(2*nHermite + 1),-0.16666999) ;
|
||||
}
|
||||
else if(i == 2)
|
||||
{
|
||||
newton -= 1.14001*pow((G4double)nHermite,0.425999)/newton ;
|
||||
newton -= 1.14001*std::pow((G4double)nHermite,0.425999)/newton ;
|
||||
}
|
||||
else if(i == 3)
|
||||
{
|
||||
@@ -78,12 +78,12 @@ G4GaussHermiteQ::G4GaussHermiteQ( function pFunction,
|
||||
{
|
||||
temp3 = temp2 ;
|
||||
temp2 = temp1 ;
|
||||
temp1 = newton*sqrt(2.0/j)*temp2 - sqrt(((G4double)(j - 1))/j)*temp3 ;
|
||||
temp1 = newton*std::sqrt(2.0/j)*temp2 - std::sqrt(((G4double)(j - 1))/j)*temp3 ;
|
||||
}
|
||||
temp = sqrt((G4double)2*nHermite)*temp2 ;
|
||||
temp = std::sqrt((G4double)2*nHermite)*temp2 ;
|
||||
newton1 = newton ;
|
||||
newton = newton1 - temp1/temp ;
|
||||
if(fabs(newton - newton1) <= tolerance)
|
||||
if(std::fabs(newton - newton1) <= tolerance)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ G4GaussHermiteQ::G4GaussHermiteQ( function pFunction,
|
||||
|
||||
// ----------------------------------------------------------
|
||||
//
|
||||
// Gauss-Hermite method for integration of exp(-x*x)*nFunction(x) from minus infinity
|
||||
// Gauss-Hermite method for integration of std::exp(-x*x)*nFunction(x) from minus infinity
|
||||
// to plus infinity .
|
||||
|
||||
G4double
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussJacobiQ.cc,v 1.4 2001/07/11 10:00:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4GaussJacobiQ.cc,v 1.5 2004/11/12 17:38:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
#include "G4GaussJacobiQ.hh"
|
||||
|
||||
@@ -66,7 +66,7 @@ G4GaussJacobiQ::G4GaussJacobiQ( function pFunction,
|
||||
{
|
||||
root1=(4.1002+alpha)/((1.0+alpha)*(1.0+0.155998*alpha)) ;
|
||||
root2=1.0+0.06*(nJacobi-8.0)*(1.0+0.12*alpha)/nJacobi ;
|
||||
root3=1.0+0.012002*beta*(1.0+0.24997*fabs(alpha))/nJacobi ;
|
||||
root3=1.0+0.012002*beta*(1.0+0.24997*std::fabs(alpha))/nJacobi ;
|
||||
root -= (1.0-root)*root1*root2*root3 ;
|
||||
}
|
||||
else if (i == 3)
|
||||
@@ -115,7 +115,7 @@ G4GaussJacobiQ::G4GaussJacobiQ( function pFunction,
|
||||
(temp*(1.0 - root*root)) ;
|
||||
rootTemp = root ;
|
||||
root = rootTemp - newton1/newton ;
|
||||
if (fabs(root-rootTemp) <= tolerance)
|
||||
if (std::fabs(root-rootTemp) <= tolerance)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
@@ -125,11 +125,11 @@ G4GaussJacobiQ::G4GaussJacobiQ( function pFunction,
|
||||
G4Exception("Too many iterations in G4GaussJacobiQ::G4GaussJacobiQ") ;
|
||||
}
|
||||
fAbscissa[i-1] = root ;
|
||||
fWeight[i-1] = exp(GammaLogarithm((G4double)(alpha+nJacobi)) +
|
||||
fWeight[i-1] = std::exp(GammaLogarithm((G4double)(alpha+nJacobi)) +
|
||||
GammaLogarithm((G4double)(beta+nJacobi)) -
|
||||
GammaLogarithm((G4double)(nJacobi+1.0)) -
|
||||
GammaLogarithm((G4double)(nJacobi + alphaBeta + 1.0)))
|
||||
*temp*pow(2.0,alphaBeta)/(newton*newton2) ;
|
||||
*temp*std::pow(2.0,alphaBeta)/(newton*newton2) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussLaguerreQ.cc,v 1.4 2001/07/11 10:00:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4GaussLaguerreQ.cc,v 1.5 2004/11/12 17:38:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
#include "G4GaussLaguerreQ.hh"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// Constructor for Gauss-Laguerre quadrature method: integral from zero to
|
||||
// infinity of pow(x,alpha)*exp(-x)*f(x). The value of nLaguerre sets the accuracy.
|
||||
// infinity of std::pow(x,alpha)*std::exp(-x)*f(x). The value of nLaguerre sets the accuracy.
|
||||
// The constructor creates arrays fAbscissa[0,..,nLaguerre-1] and
|
||||
// fWeight[0,..,nLaguerre-1] .
|
||||
//
|
||||
@@ -80,7 +80,7 @@ G4GaussLaguerreQ::G4GaussLaguerreQ( function pFunction,
|
||||
temp = (fNumber*temp1 - (fNumber +alpha)*temp2)/newton ;
|
||||
newton1 = newton ;
|
||||
newton = newton1 - temp1/temp ;
|
||||
if(fabs(newton - newton1) <= tolerance)
|
||||
if(std::fabs(newton - newton1) <= tolerance)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
@@ -91,14 +91,14 @@ G4GaussLaguerreQ::G4GaussLaguerreQ( function pFunction,
|
||||
}
|
||||
|
||||
fAbscissa[i-1] = newton ;
|
||||
fWeight[i-1] = -exp(GammaLogarithm(alpha + fNumber) -
|
||||
fWeight[i-1] = -std::exp(GammaLogarithm(alpha + fNumber) -
|
||||
GammaLogarithm((G4double)fNumber))/(temp*fNumber*temp2) ;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
//
|
||||
// Gauss-Laguerre method for integration of pow(x,alpha)*exp(-x)*pFunction(x)
|
||||
// Gauss-Laguerre method for integration of std::pow(x,alpha)*std::exp(-x)*pFunction(x)
|
||||
// from zero up to infinity. pFunction is evaluated in fNumber points for which
|
||||
// fAbscissa[i] and fWeight[i] arrays were created in
|
||||
// G4VGaussianQuadrature(double,int) constructor
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GaussLegendreQ.cc,v 1.3 2001/07/11 10:00:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4GaussLegendreQ.cc,v 1.4 2004/11/12 17:38:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
#include "G4GaussLegendreQ.hh"
|
||||
|
||||
@@ -62,7 +62,7 @@ G4GaussLegendreQ::G4GaussLegendreQ( function pFunction,
|
||||
|
||||
for(i=1;i<=fNumber;i++) // Loop over the desired roots
|
||||
{
|
||||
newton = cos(pi*(i - 0.25)/(k + 0.5)) ; // Initial root approximation
|
||||
newton = std::cos(pi*(i - 0.25)/(k + 0.5)) ; // Initial root approximation
|
||||
do
|
||||
{ // loop of Newton's method
|
||||
temp1 = 1.0 ;
|
||||
@@ -77,7 +77,7 @@ G4GaussLegendreQ::G4GaussLegendreQ( function pFunction,
|
||||
newton1 = newton ;
|
||||
newton = newton1 - temp1/temp ; // Newton's method
|
||||
}
|
||||
while(fabs(newton - newton1) > tolerance) ;
|
||||
while(std::fabs(newton - newton1) > tolerance) ;
|
||||
|
||||
fAbscissa[fNumber-i] = newton ;
|
||||
fWeight[fNumber-i] = 2.0/((1.0 - newton*newton)*temp*temp) ;
|
||||
|
||||
@@ -21,12 +21,13 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleIntegration.cc,v 1.3 2001/07/11 10:00:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4SimpleIntegration.cc,v 1.5 2004/11/12 17:38:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// Implementation file for simple integration methods
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4SimpleIntegration.hh"
|
||||
|
||||
|
||||
@@ -94,7 +95,7 @@ G4SimpleIntegration::Gauss(G4double xInitial,
|
||||
{
|
||||
G4int i ;
|
||||
G4double x ;
|
||||
static G4double root = 1.0/sqrt(3.0) ;
|
||||
static G4double root = 1.0/std::sqrt(3.0) ;
|
||||
G4double Step = (xFinal - xInitial)/(2.0*iterationNumber) ;
|
||||
G4double delta = Step*root ;
|
||||
G4double mean = 0.0 ;
|
||||
@@ -147,7 +148,7 @@ G4double
|
||||
G4SimpleIntegration::Gauss( G4double xInitial,
|
||||
G4double xFinal )
|
||||
{
|
||||
static G4double root = 1.0/sqrt(3.0) ;
|
||||
static G4double root = 1.0/std::sqrt(3.0) ;
|
||||
|
||||
G4double xMean = (xInitial + xFinal)/2.0 ;
|
||||
G4double Step = (xFinal - xInitial)/2.0 ;
|
||||
@@ -172,7 +173,7 @@ G4SimpleIntegration::AdaptGauss( G4double xInitial,
|
||||
G4double leftHalf = Gauss(xInitial,xMean) ;
|
||||
G4double rightHalf = Gauss(xMean,xFinal) ;
|
||||
G4double full = Gauss(xInitial,xFinal) ;
|
||||
if(fabs(leftHalf+rightHalf-full) < fTolerance)
|
||||
if(std::fabs(leftHalf+rightHalf-full) < fTolerance)
|
||||
{
|
||||
sum += full ;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VGaussianQuadrature.cc,v 1.3 2001/07/11 10:00:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4VGaussianQuadrature.cc,v 1.5 2004/11/12 17:38:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// Implementation file for G4VGaussianQuadrature virtual base class
|
||||
//
|
||||
@@ -70,7 +70,7 @@ G4VGaussianQuadrature::GetWeight(G4int index) const
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Auxiliary function which returns the value of log(gamma-function(x))
|
||||
// Auxiliary function which returns the value of std::log(gamma-function(x))
|
||||
//
|
||||
|
||||
G4double
|
||||
@@ -84,10 +84,10 @@ G4VGaussianQuadrature::GammaLogarithm(G4double xx)
|
||||
static G4double cof[6] = { 76.18009172947146, -86.50532032941677,
|
||||
24.01409824083091, -1.231739572450155,
|
||||
0.1208650973866179e-2, -0.5395239384953e-5 } ;
|
||||
register HepInt j;
|
||||
register G4int j;
|
||||
G4double x = xx - 1.0;
|
||||
G4double tmp = x + 5.5;
|
||||
tmp -= (x + 0.5) * log(tmp);
|
||||
tmp -= (x + 0.5) * std::log(tmp);
|
||||
G4double ser = 1.000000000190015;
|
||||
|
||||
for ( j = 0; j <= 5; j++ )
|
||||
@@ -95,7 +95,7 @@ G4VGaussianQuadrature::GammaLogarithm(G4double xx)
|
||||
x += 1.0;
|
||||
ser += cof[j]/x;
|
||||
}
|
||||
return -tmp + log(2.5066282746310005*ser);
|
||||
return -tmp + std::log(2.5066282746310005*ser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# $Id: GNUmakefile,v 1.2 2004/06/11 14:18:58 gcosmo Exp $
|
||||
# $Id: GNUmakefile,v 1.3 2004/10/29 08:40:23 gcosmo Exp $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for global HEPRandom. Gunter Folger 12-Dec-2000.
|
||||
# note: this needed only to created "installed" include files.
|
||||
# This is needed only for generating "installed" include files.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
ifndef G4INSTALL
|
||||
@@ -11,5 +11,6 @@ endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -DG4IOS_EXPORT
|
||||
CPPFLAGS += -I$(G4BASE)/global/HepGeometry/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Poisson.hh,v 1.6 2001/07/11 10:00:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4Poisson.hh,v 1.7 2004/11/12 17:38:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -51,7 +51,7 @@ inline G4long G4Poisson(G4double mean)
|
||||
|
||||
if(mean <= border) {
|
||||
G4double position = RandFlat::shoot();
|
||||
G4double poissonValue = exp(-mean);
|
||||
G4double poissonValue = std::exp(-mean);
|
||||
G4double poissonSum = poissonValue;
|
||||
|
||||
while(poissonSum <= position) {
|
||||
@@ -63,10 +63,10 @@ inline G4long G4Poisson(G4double mean)
|
||||
} // the case of mean <= 16
|
||||
|
||||
G4double value, t, y;
|
||||
t = sqrt(-2*log(RandFlat::shoot()));
|
||||
t = std::sqrt(-2*std::log(RandFlat::shoot()));
|
||||
y = twopi*RandFlat::shoot();
|
||||
t *= cos(y);
|
||||
value = mean + t*sqrt(mean) + 0.5;
|
||||
t *= std::cos(y);
|
||||
value = mean + t*std::sqrt(mean) + 0.5;
|
||||
if(value <= 0) {return 0;}
|
||||
if(value >= limit) { return G4long(limit);}
|
||||
return G4long(value);
|
||||
|
||||
+51
-16
@@ -21,29 +21,64 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AllocatorUnit.hh,v 1.4 2002/05/21 10:31:25 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4RandomDirection.hh,v 1.2 2004/11/12 17:38:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// -------------- G4AllocatorUnit ----------------
|
||||
// by Tim Bell, September 1995
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4AllocatorUnit_h
|
||||
#define G4AllocatorUnit_h 1
|
||||
// Class description:
|
||||
//
|
||||
// Funtion returning a unit 3-vector homogeneously randomised over 4pi
|
||||
// solid angle. It can be used in any particle scattering methods
|
||||
// instead of:
|
||||
// z=R1, x=SQRT(1-R1*R1)*SIN(2*pi*R2), y=SQRT(1-R1*R1)*COS(2*pi*R2)
|
||||
// providing more performant results.
|
||||
// ------------------------------------------------------------
|
||||
#ifndef G4RANDOMDIR_HH
|
||||
#define G4RANDOMDIR_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
template <class Type>
|
||||
class G4AllocatorUnit
|
||||
inline G4ThreeVector G4RandomDirection()
|
||||
{
|
||||
public:
|
||||
int deleted;
|
||||
G4AllocatorUnit<Type> *fNext;
|
||||
Type fElement;
|
||||
};
|
||||
// Randomization in one of 8 Quadrants (x>0, y>0, z>0)
|
||||
//
|
||||
G4double x=G4UniformRand(), y=G4UniformRand(), z=G4UniformRand();
|
||||
G4double r2= x*x+y*y+z*z;
|
||||
while(r2>1.||r2<.000001)
|
||||
{
|
||||
x = G4UniformRand(); y = G4UniformRand(); z = G4UniformRand();
|
||||
r2=x*x+y*y+z*z;
|
||||
}
|
||||
G4double r=std::sqrt(r2), quad=G4UniformRand();
|
||||
|
||||
#endif
|
||||
if(quad>0.5)
|
||||
{
|
||||
if(quad>0.75)
|
||||
{
|
||||
if(quad>0.875) return G4ThreeVector(-x/r,-y/r,-z/r);
|
||||
else return G4ThreeVector(-x/r,-y/r, z/r);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(quad>0.625) return G4ThreeVector(-x/r, y/r,-z/r);
|
||||
else return G4ThreeVector(-x/r, y/r, z/r);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(quad>0.25)
|
||||
{
|
||||
if(quad>0.375) return G4ThreeVector( x/r,-y/r,-z/r);
|
||||
else return G4ThreeVector( x/r,-y/r, z/r);
|
||||
}
|
||||
else if(quad>0.125) return G4ThreeVector( x/r, y/r,-z/r);
|
||||
}
|
||||
return G4ThreeVector( x/r, y/r, z/r);
|
||||
}
|
||||
|
||||
#endif /* G4RANDOMDIR_HH */
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: Randomize.hh,v 1.5 2001/07/11 10:00:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
#ifndef randomize_h
|
||||
#define randomize_h 1
|
||||
|
||||
+31
-1
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.128 2004/06/11 15:11:14 gcosmo Exp $
|
||||
$Id: History,v 1.136 2004/12/02 10:09:14 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,36 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
Dec 02, 2004 G.Cosmo (global-V06-02-05)
|
||||
- Added inclusion of <cstddef> to G4Allocator.hh to make the header
|
||||
self-consistent.
|
||||
|
||||
Nov 12, 2004 G.Cosmo (global-V06-02-04)
|
||||
- Migrated code to use 'std' namespace for mathematical functions
|
||||
included from <cmath>. Removed explicit inclusion of CLHEP.h and
|
||||
therefore also implicit inclusions of system headers <math.h>,
|
||||
<stdlib.h> and <limits.h>.
|
||||
- Removed implicit inclusion of CLHEP's template function abs(), use
|
||||
now standard function std::abs() instead.
|
||||
|
||||
Nov 01, 2004 H.Kurasige (global-V06-02-03)
|
||||
- Code cleanup in G4PhysicsTable implementation.
|
||||
- Added push_back() method.
|
||||
|
||||
Oct 29, 2004 G.Cosmo (global-V06-02-02)
|
||||
- Added global function G4RandomDirection() providing a random 3-vector
|
||||
normalised in 4pi.
|
||||
- Cleared obsolete setup for min/max macros required for Windows/VC++6.
|
||||
|
||||
Oct 25, 2004 H.Kurashige (global-V06-02-01)
|
||||
- Added collection of flags and related methods in G4PhysicsTable.
|
||||
The collection of boolean values will be used by physics processes
|
||||
to flag if recomputation will be required or not.
|
||||
|
||||
Jul 1, 2004 G.Cosmo (global-V06-02-00)
|
||||
- Merge developments included in "global-V06-01-02" for the new
|
||||
G4Allocator implementation.
|
||||
|
||||
Jun 11, 2004 G.Cosmo (global-V06-01-02c)
|
||||
- Use global flag G4IOS_EXPORT to export extern symbols for DLLs.
|
||||
Modified granular GNUmakefiles and corrected G4ios.cc to the new scheme.
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Allocator.hh,v 1.14 2004/05/14 17:40:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// $Id: G4Allocator.hh,v 1.16 2004/11/29 17:53:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -30,30 +30,30 @@
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// A class for fast allocation of objects to the heap through paging
|
||||
// mechanism. It's meant to be used by associating it to the object to
|
||||
// be allocated and defining for it new and delete operators via
|
||||
// MallocSingle() and FreeSingle() methods.
|
||||
// A class for fast allocation of objects to the heap through a pool of
|
||||
// chunks organised as linked list. It's meant to be used by associating
|
||||
// it to the object to be allocated and defining for it new and delete
|
||||
// operators via MallocSingle() and FreeSingle() methods.
|
||||
|
||||
// ---------------- G4Allocator ----------------
|
||||
// by Tim Bell, September 1995
|
||||
//
|
||||
// Author: G.Cosmo (CERN), November 2000
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4Allocator_h
|
||||
#define G4Allocator_h 1
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
|
||||
#include "G4AllocatorPage.hh"
|
||||
#include "G4AllocatorPool.hh"
|
||||
|
||||
template <class Type>
|
||||
class G4Allocator
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4Allocator();
|
||||
~G4Allocator();
|
||||
G4Allocator() throw();
|
||||
~G4Allocator() throw();
|
||||
// Constructor & destructor
|
||||
|
||||
inline Type* MallocSingle();
|
||||
@@ -66,41 +66,95 @@ class G4Allocator
|
||||
// allocator and page sizes.
|
||||
// Note: contents in memory are lost using this call !
|
||||
|
||||
inline int GetAllocatedSize();
|
||||
inline size_t GetAllocatedSize() const;
|
||||
// Returns the size of the total memory allocated
|
||||
|
||||
private:
|
||||
public: // without description
|
||||
|
||||
void AddNewPage();
|
||||
Type* AddNewElement();
|
||||
// This public section includes standard methods and types
|
||||
// required if the allocator is to be used as alternative
|
||||
// allocator for STL containers.
|
||||
// NOTE: the code below is a trivial implementation to make
|
||||
// this class an STL compliant allocator.
|
||||
// It is anyhow NOT recommended to use this class as
|
||||
// alternative allocator for STL containers !
|
||||
|
||||
typedef Type value_type;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef Type* pointer;
|
||||
typedef const Type* const_pointer;
|
||||
typedef Type& reference;
|
||||
typedef const Type& const_reference;
|
||||
|
||||
template <class U> G4Allocator(const G4Allocator<U>& right) throw()
|
||||
{ *this = right; }
|
||||
// Copy constructor
|
||||
|
||||
pointer address(reference r) const { return &r; }
|
||||
const_pointer address(const_reference r) const { return &r; }
|
||||
// Returns the address of values
|
||||
|
||||
pointer allocate(size_type n, void* hint = 0)
|
||||
{
|
||||
// Allocates space for n elements of type Type, but does not initialise
|
||||
//
|
||||
Type* mem_alloc = 0;
|
||||
if (n == 1)
|
||||
mem_alloc = MallocSingle();
|
||||
else
|
||||
mem_alloc = static_cast<Type*>(::operator new(n*sizeof(Type)));
|
||||
return mem_alloc;
|
||||
}
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
// Deallocates n elements of type Type, but doesn't destroy
|
||||
//
|
||||
if (n == 1)
|
||||
FreeSingle(p);
|
||||
else
|
||||
::operator delete((void*)p);
|
||||
return;
|
||||
}
|
||||
|
||||
void construct(pointer p, const Type& val) { new((void*)p) Type(val); }
|
||||
// Initialises *p by val
|
||||
void destroy(pointer p) { p->~Type(); }
|
||||
// Destroy *p but doesn't deallocate
|
||||
|
||||
size_type max_size() const throw()
|
||||
{
|
||||
// Returns the maximum number of elements that can be allocated
|
||||
//
|
||||
return 2147483647/sizeof(Type);
|
||||
}
|
||||
|
||||
template <class U>
|
||||
struct rebind { typedef G4Allocator<U> other; };
|
||||
// Rebind allocator to type U
|
||||
|
||||
private:
|
||||
|
||||
enum { Allocated = 0x47416C, Deleted = 0xB8BE93 };
|
||||
|
||||
G4AllocatorPage<Type> * fPages;
|
||||
G4AllocatorUnit<Type> * fFreeList;
|
||||
|
||||
size_t fUnitSize, fPageSize;
|
||||
G4AllocatorPool mem;
|
||||
// Pool of elements of sizeof(Type)
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Inline implementation
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// Initialization of the static pool
|
||||
//
|
||||
// template <class Type> G4AllocatorPool G4Allocator<Type>::mem(sizeof(Type));
|
||||
|
||||
// ************************************************************
|
||||
// G4Allocator constructor
|
||||
// ************************************************************
|
||||
//
|
||||
template <class Type>
|
||||
G4Allocator<Type>::G4Allocator()
|
||||
G4Allocator<Type>::G4Allocator() throw()
|
||||
: mem(sizeof(Type))
|
||||
{
|
||||
fPages = 0;
|
||||
fFreeList = 0;
|
||||
fUnitSize = sizeof(G4AllocatorUnit<Type>);
|
||||
fPageSize = ( (fUnitSize < 512) ? 1024 : (fUnitSize*10) );
|
||||
AddNewPage();
|
||||
return;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
@@ -108,22 +162,8 @@ G4Allocator<Type>::G4Allocator()
|
||||
// ************************************************************
|
||||
//
|
||||
template <class Type>
|
||||
G4Allocator<Type>::~G4Allocator()
|
||||
G4Allocator<Type>::~G4Allocator() throw()
|
||||
{
|
||||
G4AllocatorPage<Type> * aPage;
|
||||
G4AllocatorPage<Type> * aNextPage;
|
||||
|
||||
aPage = fPages;
|
||||
while (aPage != 0)
|
||||
{
|
||||
aNextPage = aPage->fNext;
|
||||
free(aPage->fUnits);
|
||||
delete aPage;
|
||||
aPage = aNextPage;
|
||||
}
|
||||
fPages = 0;
|
||||
fFreeList = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
@@ -133,17 +173,7 @@ G4Allocator<Type>::~G4Allocator()
|
||||
template <class Type>
|
||||
Type* G4Allocator<Type>::MallocSingle()
|
||||
{
|
||||
Type * anElement;
|
||||
|
||||
if (fFreeList != 0)
|
||||
{
|
||||
fFreeList->deleted = Allocated;
|
||||
anElement = &fFreeList->fElement;
|
||||
fFreeList = fFreeList->fNext;
|
||||
}
|
||||
else
|
||||
anElement = AddNewElement();
|
||||
return anElement;
|
||||
return static_cast<Type*>(mem.Alloc());
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
@@ -153,53 +183,8 @@ Type* G4Allocator<Type>::MallocSingle()
|
||||
template <class Type>
|
||||
void G4Allocator<Type>::FreeSingle(Type* anElement)
|
||||
{
|
||||
G4AllocatorUnit<Type> * fUnit;
|
||||
|
||||
// The gcc-3.1 compiler will complain and not correctly handle offsets
|
||||
// computed from non-POD types. Pointers to member data should be used
|
||||
// instead. This C++ feature seems not to work on earlier versions of
|
||||
// the same compiler.
|
||||
//
|
||||
#if (__GNUC__==3) && (__GNUC_MINOR__>0)
|
||||
Type G4AllocatorUnit<Type>::*pOffset = &G4AllocatorUnit<Type>::fElement;
|
||||
fUnit = (G4AllocatorUnit<Type> *) ((char *)anElement - size_t(pOffset));
|
||||
#else
|
||||
fUnit = (G4AllocatorUnit<Type> *)
|
||||
((char *) anElement - offsetof(G4AllocatorUnit<Type>, fElement));
|
||||
#endif
|
||||
|
||||
if (fUnit->deleted == Allocated)
|
||||
{
|
||||
fUnit->deleted = Deleted;
|
||||
fUnit->fNext = fFreeList;
|
||||
fFreeList = fUnit;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// AddNewPage
|
||||
// ************************************************************
|
||||
//
|
||||
template <class Type>
|
||||
void G4Allocator<Type>::AddNewPage()
|
||||
{
|
||||
G4AllocatorPage<Type> * aPage;
|
||||
register G4int unit_no;
|
||||
|
||||
aPage = new G4AllocatorPage<Type>;
|
||||
aPage->fNext = fPages;
|
||||
aPage->fUnits = (G4AllocatorUnit<Type> *)
|
||||
malloc(fPageSize);
|
||||
fPages = aPage;
|
||||
|
||||
for (unit_no = 0;
|
||||
unit_no < G4int(fPageSize/fUnitSize - 1);
|
||||
++unit_no)
|
||||
{
|
||||
aPage->fUnits[unit_no].fNext = &aPage->fUnits[unit_no + 1];
|
||||
}
|
||||
aPage->fUnits[unit_no].fNext = fFreeList;
|
||||
fFreeList = &aPage->fUnits[0];
|
||||
mem.Free(anElement);
|
||||
return;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
@@ -211,25 +196,8 @@ void G4Allocator<Type>::ResetStorage()
|
||||
{
|
||||
// Clear all allocated storage and return it to the free store
|
||||
//
|
||||
G4AllocatorPage<Type> * aPage;
|
||||
G4AllocatorPage<Type> * aNextPage;
|
||||
|
||||
aPage = fPages;
|
||||
while (aPage != 0)
|
||||
{
|
||||
aNextPage = aPage->fNext;
|
||||
free(aPage->fUnits);
|
||||
delete aPage;
|
||||
aPage = aNextPage;
|
||||
}
|
||||
|
||||
// Reset unit&page size and allocate a single page
|
||||
//
|
||||
fPages = 0;
|
||||
fFreeList = 0;
|
||||
fUnitSize = sizeof(G4AllocatorUnit<Type>);
|
||||
fPageSize = ( (fUnitSize < 512) ? 1024 : (fUnitSize*10) );
|
||||
AddNewPage();
|
||||
mem.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
@@ -237,33 +205,29 @@ void G4Allocator<Type>::ResetStorage()
|
||||
// ************************************************************
|
||||
//
|
||||
template <class Type>
|
||||
int G4Allocator<Type>::GetAllocatedSize()
|
||||
size_t G4Allocator<Type>::GetAllocatedSize() const
|
||||
{
|
||||
G4AllocatorPage<Type> * aPage = fPages;
|
||||
int count = 0;
|
||||
|
||||
while (aPage != 0)
|
||||
{
|
||||
aPage = aPage->fNext;
|
||||
count++;
|
||||
}
|
||||
return count*fPageSize;
|
||||
return mem.Size();
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// AddNewElement
|
||||
// operator==
|
||||
// ************************************************************
|
||||
//
|
||||
template <class Type>
|
||||
Type* G4Allocator<Type>::AddNewElement()
|
||||
template <class T1, class T2>
|
||||
bool operator== (const G4Allocator<T1>&, const G4Allocator<T2>&) throw()
|
||||
{
|
||||
Type* anElement;
|
||||
return true;
|
||||
}
|
||||
|
||||
AddNewPage();
|
||||
fFreeList->deleted = Allocated;
|
||||
anElement = &fFreeList->fElement;
|
||||
fFreeList=fFreeList->fNext;
|
||||
return anElement;
|
||||
// ************************************************************
|
||||
// operator!=
|
||||
// ************************************************************
|
||||
//
|
||||
template <class T1, class T2>
|
||||
bool operator!= (const G4Allocator<T1>&, const G4Allocator<T2>&) throw()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AllocatorPage.hh,v 1.4 2002/05/21 10:31:25 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// -------------- G4AllocatorPage ----------------
|
||||
// by Tim Bell, September 1995
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4AllocatorPage_h
|
||||
#define G4AllocatorPage_h 1
|
||||
|
||||
#include "G4AllocatorUnit.hh"
|
||||
|
||||
template <class Type>
|
||||
class G4AllocatorPage
|
||||
{
|
||||
public:
|
||||
G4AllocatorPage<Type> *fNext;
|
||||
G4AllocatorUnit<Type> *fUnits;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,141 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AllocatorPool.hh,v 1.2 2004/11/12 16:25:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Class implementing a memory pool for fast allocation and deallocation
|
||||
// of memory chunks. The size of the chunks for small allocated objects
|
||||
// is fixed to 1Kb and takes into account of memory alignment; for large
|
||||
// objects it is set to 10 times the object's size.
|
||||
// The implementation is derived from: B.Stroustrup, The C++ Programming
|
||||
// Language, Third Edition.
|
||||
|
||||
// -------------- G4AllocatorPool ----------------
|
||||
//
|
||||
// Author: G.Cosmo (CERN), November 2000
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef G4AllocatorPool_h
|
||||
#define G4AllocatorPool_h 1
|
||||
|
||||
class G4AllocatorPool
|
||||
{
|
||||
public:
|
||||
|
||||
G4AllocatorPool( unsigned int n );
|
||||
// Create a pool of elements of size n
|
||||
~G4AllocatorPool();
|
||||
// Destructor. Return storage to the free store
|
||||
|
||||
G4AllocatorPool(const G4AllocatorPool& right);
|
||||
// Copy constructor
|
||||
|
||||
inline void* Alloc();
|
||||
// Allocate one element
|
||||
inline void Free( void* b );
|
||||
// Return an element back to the pool
|
||||
|
||||
inline unsigned int Size() const;
|
||||
// Return storage size
|
||||
void Reset();
|
||||
// Return storage to the free store
|
||||
|
||||
private:
|
||||
|
||||
G4AllocatorPool& operator= (const G4AllocatorPool& right);
|
||||
// Private equality operator
|
||||
|
||||
struct G4PoolLink
|
||||
{
|
||||
G4PoolLink* next;
|
||||
};
|
||||
class G4PoolChunk
|
||||
{
|
||||
public:
|
||||
G4PoolChunk(unsigned int sz)
|
||||
: size(sz), mem(new char[size]), next(0) {;}
|
||||
~G4PoolChunk() { delete [] mem; }
|
||||
const unsigned int size;
|
||||
char* mem;
|
||||
G4PoolChunk* next;
|
||||
};
|
||||
|
||||
void Grow();
|
||||
// Make pool larger
|
||||
|
||||
private:
|
||||
|
||||
G4PoolChunk* chunks;
|
||||
const unsigned int esize;
|
||||
const unsigned int csize;
|
||||
G4PoolLink* head;
|
||||
int nchunks;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Inline implementation
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// ************************************************************
|
||||
// Alloc
|
||||
// ************************************************************
|
||||
//
|
||||
inline void*
|
||||
G4AllocatorPool::Alloc()
|
||||
{
|
||||
if (head==0) Grow();
|
||||
G4PoolLink* p = head; // return first element
|
||||
head = p->next;
|
||||
return p;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// Free
|
||||
// ************************************************************
|
||||
//
|
||||
inline void
|
||||
G4AllocatorPool::Free( void* b )
|
||||
{
|
||||
G4PoolLink* p = static_cast<G4PoolLink*>(b);
|
||||
p->next = head; // put b back as first element
|
||||
head = p;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// Size
|
||||
// ************************************************************
|
||||
//
|
||||
inline unsigned int
|
||||
G4AllocatorPool::Size() const
|
||||
{
|
||||
return nchunks*csize;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ApplicationState.hh,v 1.3 2002/12/04 17:39:50 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
|
||||
#ifndef G4APPLICATIONSTATE_H
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DataVector.hh,v 1.12 2003/06/06 16:17:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ExceptionSeverity.hh,v 1.2 2002/08/26 14:56:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FastVector.hh,v 1.4 2001/07/11 10:00:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LPhysicsFreeVector.hh,v 1.7 2001/07/11 10:00:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LPhysicsFreeVector.icc,v 1.5 2001/07/11 10:00:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OrderedTable.hh,v 1.11 2003/06/06 16:17:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsFreeVector.hh,v 1.8 2001/07/11 10:00:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLinearVector.hh,v 1.8 2003/06/06 16:17:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLnVector.hh,v 1.9 2003/06/06 16:17:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4PhysicsLnVector.hh,v 1.10 2004/11/12 17:38:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
@@ -96,7 +96,7 @@ inline
|
||||
// not through pointers or references. In this case, the 'inline' will
|
||||
// be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6)
|
||||
|
||||
return size_t( log(theEnergy)/dBin - baseBin );
|
||||
return size_t( std::log(theEnergy)/dBin - baseBin );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLogVector.hh,v 1.8 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4PhysicsLogVector.hh,v 1.9 2004/11/12 17:38:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
@@ -100,7 +100,7 @@ inline
|
||||
// not through pointers or references. In this case, the 'inline' will
|
||||
// be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6)
|
||||
|
||||
return size_t( log10(theEnergy)/dBin - baseBin );
|
||||
return size_t( std::log10(theEnergy)/dBin - baseBin );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsOrderedFreeVector.hh,v 1.8 2001/07/11 10:00:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PhysicsOrderedFreeVector Class Definition
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsOrderedFreeVector.icc,v 1.6 2001/07/11 10:00:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PhysicsOrderedFreeVector Class Inline Functions Definitions
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsTable.hh,v 1.13 2003/11/04 10:38:03 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4PhysicsTable.hh,v 1.15 2004/10/29 11:38:08 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -38,6 +38,8 @@
|
||||
// The constructor given the 'capacity' of the table, pre-allocates
|
||||
// memory for the specified value by invoking the STL's reserve()
|
||||
// function, in order to avoid reallocation during insertions.
|
||||
// G4PhysicsTable has a vector of boolean which are used
|
||||
// as 'recalc-needed' flags when processes calculate physics tables.
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// History:
|
||||
@@ -47,6 +49,7 @@
|
||||
// - 1st March 1996, modified. K.Amako
|
||||
// - 24th February 2001, migration to STL vectors. H.Kurashige
|
||||
// - 9th March 2001, added Store/RetrievePhysicsTable. H.Kurashige
|
||||
// - 20th August 2004, added FlagArray and related methods H.Kurashige
|
||||
//-------------------------------------
|
||||
|
||||
#ifndef G4PhysicsTable_h
|
||||
@@ -62,7 +65,8 @@ class G4PhysicsTable : public std::vector<G4PhysicsVector*>
|
||||
{
|
||||
|
||||
typedef std::vector<G4PhysicsVector*> G4PhysCollection;
|
||||
|
||||
typedef std::vector<G4bool> G4FlagCollection;
|
||||
|
||||
public: // with description
|
||||
|
||||
G4PhysicsTable();
|
||||
@@ -83,12 +87,16 @@ class G4PhysicsTable : public std::vector<G4PhysicsVector*>
|
||||
void clearAndDestroy();
|
||||
// Removes all items and deletes them at the same time.
|
||||
|
||||
void push_back( G4PhysicsVector* );
|
||||
void insert (G4PhysicsVector*);
|
||||
// Pushes new element to collection.
|
||||
|
||||
void insertAt (size_t, G4PhysicsVector*);
|
||||
// Inserts element at the specified position in the collection.
|
||||
|
||||
// insert element at the specified position in the collection.
|
||||
|
||||
void resize(size_t, G4PhysicsVector* vec = (G4PhysicsVector*)(0));
|
||||
// resize collection
|
||||
|
||||
size_t entries() const;
|
||||
size_t length() const;
|
||||
// Return collection's size.
|
||||
@@ -105,11 +113,23 @@ class G4PhysicsTable : public std::vector<G4PhysicsVector*>
|
||||
G4bool RetrievePhysicsTable(const G4String& filename, G4bool ascii=false);
|
||||
// Retrieves Physics from a file (returns false in case of failure).
|
||||
|
||||
void ResetFlagArray();
|
||||
// Reset the array of flags and all flags are set "true"
|
||||
// This flag is supposed to be used as "recalc-needed" flag
|
||||
// associated with each physics vector
|
||||
|
||||
G4bool GetFlag(size_t i) const;
|
||||
void ClearFlag(size_t i);
|
||||
// Get/Clear the flag for the 'i-th' physics vector
|
||||
|
||||
public:
|
||||
friend std::ostream& operator<<(std::ostream& out, G4PhysicsTable& table);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
G4PhysicsVector* CreatePhysicsVector(G4int type);
|
||||
G4FlagCollection vecFlag;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsTable.icc,v 1.4 2001/07/11 10:00:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4PhysicsTable.icc,v 1.6 2004/10/29 11:38:08 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -38,10 +38,12 @@ inline
|
||||
{
|
||||
G4PhysicsVector* a;
|
||||
while (size()>0) {
|
||||
a = back();
|
||||
pop_back();
|
||||
a = G4PhysCollection::back();
|
||||
G4PhysCollection::pop_back();
|
||||
if ( a ) delete a;
|
||||
}
|
||||
|
||||
vecFlag.clear();
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -56,10 +58,18 @@ inline
|
||||
return (*this)[i];
|
||||
}
|
||||
|
||||
inline
|
||||
void G4PhysicsTable::push_back(G4PhysicsVector* pvec)
|
||||
{
|
||||
G4PhysCollection::push_back(pvec);
|
||||
vecFlag.push_back(true);
|
||||
}
|
||||
|
||||
inline
|
||||
void G4PhysicsTable::insert(G4PhysicsVector* pvec)
|
||||
{
|
||||
push_back(pvec);
|
||||
G4PhysCollection::push_back(pvec);
|
||||
vecFlag.push_back(true);
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -68,22 +78,38 @@ inline
|
||||
G4PhysicsTableIterator itr=begin();
|
||||
for (size_t i=0; i<idx; ++i) itr++;
|
||||
G4PhysCollection::insert(itr, pvec);
|
||||
|
||||
G4FlagCollection::iterator itrF=vecFlag.begin();
|
||||
for (size_t j=0; j<idx; ++j) itrF++;
|
||||
vecFlag.insert(itrF, true);
|
||||
}
|
||||
|
||||
inline
|
||||
size_t G4PhysicsTable::entries() const
|
||||
{
|
||||
return size();
|
||||
return G4PhysCollection::size();
|
||||
}
|
||||
|
||||
inline
|
||||
size_t G4PhysicsTable::length() const
|
||||
{
|
||||
return size();
|
||||
return G4PhysCollection::size();
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4PhysicsTable::isEmpty() const
|
||||
{
|
||||
return empty();
|
||||
return G4PhysCollection::empty();
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4PhysicsTable::GetFlag(size_t i) const
|
||||
{
|
||||
return vecFlag[i];
|
||||
}
|
||||
|
||||
inline
|
||||
void G4PhysicsTable::ClearFlag(size_t i)
|
||||
{
|
||||
vecFlag[i] = false;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVector.hh,v 1.12 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVector.icc,v 1.7 2001/07/11 10:00:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVectorType.hh,v 1.3 2001/07/11 10:00:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReferenceCountedHandle.hh,v 1.14 2001/11/07 09:35:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// Class G4ReferenceCountedHandle
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RotationMatrix.hh,v 1.3 2001/07/11 10:00:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SIunits.hh,v 1.3 2003/02/05 15:25:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4StateManager.hh,v 1.8 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4String.hh,v 1.4 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4String.icc,v 1.5 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ThreeVector.hh,v 1.3 2001/07/11 10:00:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Timer.hh,v 1.12 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Tokenizer.hh,v 1.1 2001/10/11 14:04:05 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Types.hh,v 1.9 2004/06/09 07:30:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// $Id: G4Types.hh,v 1.10 2004/11/12 16:25:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// GEANT4 native types
|
||||
@@ -61,7 +61,6 @@
|
||||
#undef __DEPRECATED
|
||||
#endif
|
||||
|
||||
#include <CLHEP/config/CLHEP.h>
|
||||
#include <complex>
|
||||
|
||||
// Typedefs to decouple from library classes
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UnitsTable.hh,v 1.14 2004/01/21 13:17:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserLimits.hh,v 1.8 2004/01/23 02:23:09 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// class G4UserLimits
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserLimits.icc,v 1.6 2001/07/11 10:00:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VExceptionHandler.hh,v 1.1 2002/08/19 18:20:11 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VStateDependent.hh,v 1.3 2001/07/11 10:00:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4coutDestination.hh,v 1.4 2001/07/11 10:00:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ios.hh,v 1.9 2004/06/09 07:30:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4strstreambuf.hh,v 1.12 2004/06/09 07:30:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4strstreambuf.icc,v 1.9 2003/06/06 16:17:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: globals.hh,v 1.23 2003/06/06 16:17:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: globals.hh,v 1.25 2004/11/12 16:25:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// Global Constants and typedefs
|
||||
@@ -46,33 +46,6 @@
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
// Undefine possible existing min/max/sqr/abs macros first
|
||||
// (temporary solution)
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#ifdef sqr
|
||||
#undef sqr
|
||||
#endif
|
||||
#ifdef abs
|
||||
#undef abs
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#ifndef CLHEP_MAX_MIN_DEFINED
|
||||
#define CLHEP_MAX_MIN_DEFINED
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(XPNET)
|
||||
// For NT with Native STL (used in ISO standard mode)
|
||||
// templated functions min and max should be _MIN _MAX
|
||||
#define min _MIN
|
||||
#define max _MAX
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
@@ -80,10 +53,7 @@
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
// min, max, abs and sqr are in TemplateFunctions.h.
|
||||
// Includes also CLHEP.h with typedef for numeric types and
|
||||
// implicit inclusions of <stdlib.h>, <limits.h>, <math.h>.
|
||||
#include <CLHEP/config/TemplateFunctions.h>
|
||||
#include <algorithm> // Retrieve definitions of min/max
|
||||
|
||||
// Include base types
|
||||
#include "G4Types.hh"
|
||||
@@ -91,7 +61,7 @@
|
||||
// Get definition of G4String
|
||||
#include "G4String.hh"
|
||||
|
||||
// Includes some additional definitions
|
||||
// Includes some additional definitions: sqr, G4SwapPtr, G4SwapObj.
|
||||
#include "templates.hh"
|
||||
|
||||
// System of Units and Physical Constants
|
||||
@@ -99,7 +69,10 @@
|
||||
|
||||
// Global error function
|
||||
#include "G4ExceptionSeverity.hh"
|
||||
void G4Exception(const char* issure,const char* errorCode,G4ExceptionSeverity severity,const char* comments);
|
||||
void G4Exception(const char* issure,
|
||||
const char* errorCode,
|
||||
G4ExceptionSeverity severity,
|
||||
const char* comments);
|
||||
void G4Exception(const char* s=0);
|
||||
void G4Exception(std::string s);
|
||||
void G4Exception(G4String s);
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: templates.hh,v 1.6 2001/07/11 10:00:55 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: templates.hh,v 1.8 2004/11/12 17:38:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// -*- C++ -*-
|
||||
@@ -120,4 +120,28 @@ inline void G4SwapObj(T* a, T* b) {
|
||||
|
||||
//-----------------------------
|
||||
|
||||
#ifndef G4_SQR_DEFINED
|
||||
#define G4_SQR_DEFINED
|
||||
#ifdef sqr
|
||||
#undef sqr
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline T sqr(const T& x)
|
||||
{
|
||||
return x*x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef G4_ABS_DEFINED
|
||||
#ifdef abs
|
||||
#undef abs
|
||||
#endif
|
||||
template <class T>
|
||||
inline T std::abs(const T& a)
|
||||
{
|
||||
return a < 0 ? -a : a;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // templates_h
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4AllocatorPool.cc,v 1.2 2004/11/12 16:25:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// G4AllocatorPool
|
||||
//
|
||||
// Implementation file
|
||||
//
|
||||
// Author: G.Cosmo, November 2000
|
||||
//
|
||||
|
||||
#include "G4AllocatorPool.hh"
|
||||
|
||||
// ************************************************************
|
||||
// G4AllocatorPool constructor
|
||||
// ************************************************************
|
||||
//
|
||||
G4AllocatorPool::G4AllocatorPool( unsigned int sz )
|
||||
: esize(sz<sizeof(G4PoolLink) ? sizeof(G4PoolLink) : sz),
|
||||
csize(sz<1024/2-16 ? 1024-16 : sz*10-16)
|
||||
{
|
||||
chunks = 0;
|
||||
head = 0;
|
||||
nchunks = 0;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// G4AllocatorPool copy constructor
|
||||
// ************************************************************
|
||||
//
|
||||
G4AllocatorPool::G4AllocatorPool(const G4AllocatorPool& right)
|
||||
: esize(right.esize), csize(right.csize)
|
||||
{
|
||||
*this = right;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// G4AllocatorPool operator=
|
||||
// ************************************************************
|
||||
//
|
||||
G4AllocatorPool&
|
||||
G4AllocatorPool::operator= (const G4AllocatorPool& right)
|
||||
{
|
||||
if (&right == this) return *this;
|
||||
chunks = right.chunks;
|
||||
head = right.head;
|
||||
nchunks = right.nchunks;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// G4AllocatorPool destructor
|
||||
// ************************************************************
|
||||
//
|
||||
G4AllocatorPool::~G4AllocatorPool()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// Reset
|
||||
// ************************************************************
|
||||
//
|
||||
void G4AllocatorPool::Reset()
|
||||
{
|
||||
// Free all chunks
|
||||
//
|
||||
G4PoolChunk* n = chunks;
|
||||
G4PoolChunk* p = 0;
|
||||
while (n)
|
||||
{
|
||||
p = n;
|
||||
n = n->next;
|
||||
delete p;
|
||||
}
|
||||
head = 0;
|
||||
chunks = 0;
|
||||
nchunks = 0;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// Grow
|
||||
// ************************************************************
|
||||
//
|
||||
void G4AllocatorPool::Grow()
|
||||
{
|
||||
// Allocate new chunk, organize it as a linked list of
|
||||
// elements of size 'esize'
|
||||
//
|
||||
G4PoolChunk* n = new G4PoolChunk(csize);
|
||||
n->next = chunks;
|
||||
chunks = n;
|
||||
nchunks++;
|
||||
|
||||
const int nelem = csize/esize;
|
||||
char* start = n->mem;
|
||||
char* last = &start[(nelem-1)*esize];
|
||||
for (char* p=start; p<last; p+=esize)
|
||||
{
|
||||
reinterpret_cast<G4PoolLink*>(p)->next
|
||||
= reinterpret_cast<G4PoolLink*>(p+esize);
|
||||
}
|
||||
reinterpret_cast<G4PoolLink*>(last)->next = 0;
|
||||
head = reinterpret_cast<G4PoolLink*>(start);
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DataVector.cc,v 1.6 2003/06/06 16:17:16 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Exception.cc,v 1.17 2003/10/31 17:44:47 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4Exception.cc,v 1.18 2004/11/12 16:25:34 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -35,7 +35,6 @@
|
||||
// 30.06.95 P.Kent
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <stdlib.h>
|
||||
#include "G4String.hh"
|
||||
#include "G4StateManager.hh"
|
||||
|
||||
@@ -55,9 +54,9 @@ void G4Exception(const char* s)
|
||||
}
|
||||
|
||||
void G4Exception(const char* originOfException,
|
||||
const char* exceptionCode,
|
||||
G4ExceptionSeverity severity,
|
||||
const char* description)
|
||||
const char* exceptionCode,
|
||||
G4ExceptionSeverity severity,
|
||||
const char* description)
|
||||
{
|
||||
G4VExceptionHandler* exceptionHandler
|
||||
= G4StateManager::GetStateManager()->GetExceptionHandler();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LPhysicsFreeVector.cc,v 1.8 2001/07/11 10:00:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OrderedTable.cc,v 1.3 2003/06/06 16:17:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsFreeVector.cc,v 1.8 2001/07/11 10:00:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLinearVector.cc,v 1.10 2003/06/06 16:17:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLnVector.cc,v 1.12 2003/06/06 16:17:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4PhysicsLnVector.cc,v 1.13 2004/11/12 17:38:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -84,11 +84,11 @@ G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
|
||||
binVector.reserve(theNbin+1);
|
||||
|
||||
numberOfBin = theNbin;
|
||||
dBin = log(theEmax/theEmin) / numberOfBin;
|
||||
baseBin = log(theEmin)/dBin;
|
||||
dBin = std::log(theEmax/theEmin) / numberOfBin;
|
||||
baseBin = std::log(theEmin)/dBin;
|
||||
|
||||
for (size_t i=0; i<numberOfBin+1; i++) {
|
||||
binVector.push_back(exp(log(theEmin)+i*dBin));
|
||||
binVector.push_back(std::exp(std::log(theEmin)+i*dBin));
|
||||
dataVector.push_back(0.0);
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ G4bool G4PhysicsLnVector::Retrieve(std::ifstream& fIn, G4bool ascii)
|
||||
G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
|
||||
if (success){
|
||||
G4double theEmin = binVector[0];
|
||||
dBin = log(binVector[1]/theEmin);
|
||||
baseBin = log(theEmin)/dBin;
|
||||
dBin = std::log(binVector[1]/theEmin);
|
||||
baseBin = std::log(theEmin)/dBin;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLogVector.cc,v 1.10 2003/06/06 16:17:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4PhysicsLogVector.cc,v 1.11 2004/11/12 17:38:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -88,11 +88,11 @@ G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
|
||||
binVector.reserve(theNbin+1);
|
||||
|
||||
numberOfBin = theNbin;
|
||||
dBin = log10(theEmax/theEmin) / numberOfBin;
|
||||
baseBin = log10(theEmin)/dBin;
|
||||
dBin = std::log10(theEmax/theEmin) / numberOfBin;
|
||||
baseBin = std::log10(theEmin)/dBin;
|
||||
|
||||
for (size_t i=0; i<numberOfBin+1; i++) {
|
||||
binVector.push_back(pow(10., log10(theEmin)+i*dBin));
|
||||
binVector.push_back(std::pow(10., std::log10(theEmin)+i*dBin));
|
||||
dataVector.push_back(0.0);
|
||||
}
|
||||
|
||||
@@ -112,8 +112,8 @@ G4bool G4PhysicsLogVector::Retrieve(std::ifstream& fIn, G4bool ascii)
|
||||
G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
|
||||
if (success){
|
||||
G4double theEmin = binVector[0];
|
||||
dBin = log10(binVector[1]/theEmin);
|
||||
baseBin = log10(theEmin)/dBin;
|
||||
dBin = std::log10(binVector[1]/theEmin);
|
||||
baseBin = std::log10(theEmin)/dBin;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.8 2001/07/11 10:00:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PhysicsOrderedFreeVector Class Implementation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsTable.cc,v 1.10 2003/11/04 12:17:30 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4PhysicsTable.cc,v 1.12 2004/10/29 11:38:08 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -47,6 +47,7 @@ G4PhysicsTable::G4PhysicsTable(size_t capacity)
|
||||
: G4PhysCollection()
|
||||
{
|
||||
reserve(capacity);
|
||||
vecFlag.reserve(capacity);
|
||||
}
|
||||
|
||||
G4PhysicsTable::G4PhysicsTable(const G4PhysicsTable& right)
|
||||
@@ -60,9 +61,11 @@ G4PhysicsTable& G4PhysicsTable::operator=(const G4PhysicsTable& right)
|
||||
if (this != &right)
|
||||
{
|
||||
G4PhysCollection::const_iterator itr;
|
||||
for (itr=right.begin(); itr!=right.end(); ++itr)
|
||||
{
|
||||
size_t idx = 0;
|
||||
for (itr=right.begin(); itr!=right.end(); ++itr ) {
|
||||
G4PhysCollection::push_back(*itr);
|
||||
vecFlag.push_back(right.GetFlag(idx));
|
||||
idx +=1;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
@@ -70,9 +73,16 @@ G4PhysicsTable& G4PhysicsTable::operator=(const G4PhysicsTable& right)
|
||||
|
||||
G4PhysicsTable::~G4PhysicsTable()
|
||||
{
|
||||
clear();
|
||||
G4PhysCollection::clear();
|
||||
vecFlag.clear();
|
||||
}
|
||||
|
||||
void G4PhysicsTable::resize(size_t size, G4PhysicsVector* vec)
|
||||
{
|
||||
G4PhysCollection::resize(size, vec);
|
||||
vecFlag.resize(size, true);
|
||||
}
|
||||
|
||||
|
||||
G4bool G4PhysicsTable::StorePhysicsTable(const G4String& fileName,
|
||||
G4bool ascii)
|
||||
@@ -88,7 +98,7 @@ G4bool G4PhysicsTable::StorePhysicsTable(const G4String& fileName,
|
||||
// check if the file has been opened successfully
|
||||
if (!fOut) {
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4PhysicsTable::::StorePhysicsTable ";
|
||||
G4cerr << "G4PhysicsTable::StorePhysicsTable ";
|
||||
G4cerr << " Can not open file " << fileName << G4endl;
|
||||
#endif
|
||||
fOut.close();
|
||||
@@ -165,6 +175,7 @@ G4bool G4PhysicsTable::RetrievePhysicsTable(const G4String& fileName,
|
||||
fIn >> tableSize;
|
||||
}
|
||||
reserve(tableSize);
|
||||
vecFlag.clear();
|
||||
|
||||
// Physics Vector
|
||||
for (size_t idx=0; idx<tableSize; ++idx) {
|
||||
@@ -196,7 +207,9 @@ G4bool G4PhysicsTable::RetrievePhysicsTable(const G4String& fileName,
|
||||
}
|
||||
|
||||
// add a PhysicsVector to this PhysicsTable
|
||||
push_back(pVec);
|
||||
G4PhysCollection::push_back(pVec);
|
||||
vecFlag.push_back(true);
|
||||
|
||||
}
|
||||
fIn.close();
|
||||
return true;
|
||||
@@ -210,7 +223,14 @@ std::ostream& operator<<(std::ostream& out,
|
||||
size_t i=0;
|
||||
for (itr=right.begin(); itr!=right.end(); ++itr) {
|
||||
out << std::setw(8) << i << "-th Vector ";
|
||||
out << ": Type " << G4int((*itr)->GetType()) << G4endl;
|
||||
out << ": Type " << G4int((*itr)->GetType()) ;
|
||||
out << ": Flag ";
|
||||
if (right.GetFlag(i)) {
|
||||
out << " T";
|
||||
} else {
|
||||
out << " F";
|
||||
}
|
||||
out << G4endl;
|
||||
out << *(*itr);
|
||||
i +=1;
|
||||
}
|
||||
@@ -218,6 +238,15 @@ std::ostream& operator<<(std::ostream& out,
|
||||
return out;
|
||||
}
|
||||
|
||||
void G4PhysicsTable::ResetFlagArray()
|
||||
{
|
||||
size_t tableSize = G4PhysCollection::size();
|
||||
vecFlag.clear();
|
||||
for (size_t idx=0; idx<tableSize; idx++){
|
||||
vecFlag.push_back(true);
|
||||
}
|
||||
}
|
||||
|
||||
#include "G4PhysicsVectorType.hh"
|
||||
#include "G4LPhysicsFreeVector.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
@@ -262,3 +291,9 @@ G4PhysicsVector* G4PhysicsTable::CreatePhysicsVector(G4int type)
|
||||
return pVector;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVector.cc,v 1.15 2003/06/06 16:17:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4StateManager.cc,v 1.10 2003/10/31 17:44:47 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Timer.cc,v 1.11 2003/06/06 16:17:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4Timer.cc,v 1.13 2004/11/22 08:14:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// class G4Timer
|
||||
//
|
||||
// Implementation
|
||||
// 29.04.97 G.Cosmo Added timings for Windows/NT
|
||||
// 29.04.97 G.Cosmo Added timings for Windows systems
|
||||
|
||||
#include "G4Timer.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnitsTable.cc,v 1.21 2004/01/21 13:17:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4UnitsTable.cc,v 1.22 2004/11/12 17:38:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//
|
||||
@@ -416,8 +416,8 @@ std::ostream& operator<<(std::ostream& flux, G4BestUnit a)
|
||||
G4double rsup(DBL_MAX), rinf(0.);
|
||||
|
||||
//for a ThreeVector, choose the best unit for the biggest value
|
||||
G4double value = std::max(std::max(fabs(a.Value[0]),fabs(a.Value[1])),
|
||||
fabs(a.Value[2]));
|
||||
G4double value = std::max(std::max(std::fabs(a.Value[0]),std::fabs(a.Value[1])),
|
||||
std::fabs(a.Value[2]));
|
||||
|
||||
for (size_t k=0; k<List.size(); k++)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VExceptionHandler.cc,v 1.1 2002/08/19 18:20:12 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VStateDependent.cc,v 1.3 2001/07/11 10:00:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ios.cc,v 1.8 2004/06/11 14:18:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user