Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -68,30 +68,40 @@ void G4AllocatorList::Destroy(G4int nStat, G4int verboseLevel)
|
||||
{
|
||||
std::vector<G4AllocatorBase*>::iterator itr=fList.begin();
|
||||
G4int i=0, j=0;
|
||||
G4double mem=0;
|
||||
G4double mem=0, tmem=0;
|
||||
if(verboseLevel>0)
|
||||
{
|
||||
G4cout << "================== Deleting memory pools ==================="
|
||||
<< G4endl;
|
||||
}
|
||||
for(; itr!=fList.end();++itr)
|
||||
{
|
||||
mem = (*itr)->GetAllocatedSize();
|
||||
if(i<nStat)
|
||||
{
|
||||
i++;
|
||||
mem += (*itr)->GetAllocatedSize();
|
||||
tmem += mem;
|
||||
(*itr)->ResetStorage();
|
||||
continue;
|
||||
}
|
||||
j++;
|
||||
mem += (*itr)->GetAllocatedSize();
|
||||
tmem += mem;
|
||||
if(verboseLevel>1)
|
||||
{
|
||||
G4cout << "Pool ID '" << (*itr)->GetPoolType() << "', size : "
|
||||
<< std::setprecision(3) << mem/1048576
|
||||
<< std::setprecision(6) << " MB" << G4endl;
|
||||
}
|
||||
(*itr)->ResetStorage();
|
||||
delete *itr;
|
||||
}
|
||||
if(verboseLevel>0)
|
||||
{
|
||||
G4cout << "================== Deleting memory pools ==================="
|
||||
<< G4endl;
|
||||
G4cout << "Number of memory pools allocated: " << Size()
|
||||
<< "; of which, static: " << i << G4endl;
|
||||
G4cout << "Dynamic pools deleted: " << j
|
||||
<< " / Total memory freed: " << std::setprecision(2)
|
||||
<< mem/1048576 << std::setprecision(6) << " Mb" << G4endl;
|
||||
<< tmem/1048576 << std::setprecision(6) << " MB" << G4endl;
|
||||
G4cout << "============================================================"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryTolerance.cc 70333 2013-05-29 08:56:45Z gcosmo $
|
||||
// $Id: G4GeometryTolerance.cc 92328 2015-08-28 07:44:26Z gcosmo $
|
||||
//
|
||||
// class G4GeometryTolerance
|
||||
//
|
||||
@@ -108,7 +108,7 @@ void G4GeometryTolerance::SetSurfaceTolerance(G4double worldExtent)
|
||||
{
|
||||
if (!fInitialised)
|
||||
{
|
||||
fCarTolerance = worldExtent*1E-11;
|
||||
fCarTolerance = fRadTolerance = worldExtent*1E-11;
|
||||
fInitialised = true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -361,17 +361,15 @@ size_t
|
||||
G4Physics2DVector::FindBinLocation(G4double z,
|
||||
const G4PV2DDataVector& v) const
|
||||
{
|
||||
size_t lowerBound = 0;
|
||||
size_t upperBound = v.size() - 2;
|
||||
size_t bin;
|
||||
size_t binmax = v.size() - 2;
|
||||
|
||||
while (lowerBound <= upperBound)
|
||||
{
|
||||
size_t midBin = (lowerBound + upperBound)/2;
|
||||
if( z < v[midBin] ) { upperBound = midBin-1; }
|
||||
else { lowerBound = midBin+1; }
|
||||
if(z <= v[0]) { bin = 0; }
|
||||
else if(z >= v[binmax]) { bin = binmax; }
|
||||
else {
|
||||
bin = std::lower_bound(v.begin(), v.end(), z) - v.begin() - 1;
|
||||
}
|
||||
|
||||
return upperBound;
|
||||
return bin;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsFreeVector.cc 74256 2013-10-02 14:24:02Z gcosmo $
|
||||
// $Id: G4PhysicsFreeVector.cc 93409 2015-10-21 13:26:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
@@ -61,7 +61,7 @@ G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin)
|
||||
dataVector.reserve(numberOfNodes);
|
||||
binVector.reserve(numberOfNodes);
|
||||
|
||||
for (size_t i=0; i<numberOfNodes; i++)
|
||||
for (size_t i=0; i<numberOfNodes; ++i)
|
||||
{
|
||||
binVector.push_back(0.0);
|
||||
dataVector.push_back(0.0);
|
||||
@@ -77,7 +77,7 @@ G4PhysicsFreeVector::G4PhysicsFreeVector(const G4DataVector& theBinVector,
|
||||
dataVector.reserve(numberOfNodes);
|
||||
binVector.reserve(numberOfNodes);
|
||||
|
||||
for (size_t i=0; i<numberOfNodes; i++)
|
||||
for (size_t i=0; i<numberOfNodes; ++i)
|
||||
{
|
||||
binVector.push_back(theBinVector[i]);
|
||||
dataVector.push_back(theDataVector[i]);
|
||||
@@ -108,31 +108,3 @@ void G4PhysicsFreeVector::PutValue( size_t theBinNumber,
|
||||
edgeMin = binVector[0];
|
||||
}
|
||||
}
|
||||
/*
|
||||
size_t G4PhysicsFreeVector::FindBinLocation(G4double theEnergy) const
|
||||
{
|
||||
// For G4PhysicsFreeVector, FindBinLocation is implemented using
|
||||
// the binary search algorithm.
|
||||
//
|
||||
// Because this is a virtual function, it is accessed through a
|
||||
// pointer to the G4PhysicsVector object for most usages. In this
|
||||
// case, 'inline' will not be invoked. However, there is a possibility
|
||||
// that the user access to the G4PhysicsFreeVector object directly and
|
||||
// not through pointers or references. In this case, the 'inline' will
|
||||
// be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6)
|
||||
|
||||
size_t lowerBound = 0;
|
||||
size_t upperBound = numberOfNodes-2;
|
||||
|
||||
while (lowerBound <= upperBound)
|
||||
{
|
||||
size_t midBin = (lowerBound + upperBound)/2;
|
||||
if( theEnergy < binVector[midBin] )
|
||||
{ upperBound = midBin-1; }
|
||||
else
|
||||
{ lowerBound = midBin+1; }
|
||||
}
|
||||
|
||||
return upperBound;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLinearVector.cc 74256 2013-10-02 14:24:02Z gcosmo $
|
||||
// $Id: G4PhysicsLinearVector.cc 93409 2015-10-21 13:26:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
@@ -55,7 +55,7 @@ G4PhysicsLinearVector::G4PhysicsLinearVector(size_t theNbin)
|
||||
dataVector.reserve(numberOfNodes);
|
||||
binVector.reserve(numberOfNodes);
|
||||
|
||||
for (size_t i=0; i<numberOfNodes; i++)
|
||||
for (size_t i=0; i<numberOfNodes; ++i)
|
||||
{
|
||||
binVector.push_back(0.0);
|
||||
dataVector.push_back(0.0);
|
||||
@@ -78,7 +78,7 @@ G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin,
|
||||
binVector.push_back(theEmin);
|
||||
dataVector.push_back(0.0);
|
||||
|
||||
for (size_t i=1; i<numberOfNodes-1; i++)
|
||||
for (size_t i=1; i<numberOfNodes-1; ++i)
|
||||
{
|
||||
binVector.push_back( theEmin + i*dBin );
|
||||
dataVector.push_back(0.0);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLnVector.cc 74256 2013-10-02 14:24:02Z gcosmo $
|
||||
// $Id: G4PhysicsLnVector.cc 93409 2015-10-21 13:26:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -56,7 +56,7 @@ G4PhysicsLnVector::G4PhysicsLnVector(size_t theNbin)
|
||||
dataVector.reserve(numberOfNodes);
|
||||
binVector.reserve(numberOfNodes);
|
||||
|
||||
for (size_t i=0; i<numberOfNodes; i++)
|
||||
for (size_t i=0; i<numberOfNodes; ++i)
|
||||
{
|
||||
binVector.push_back(0.0);
|
||||
dataVector.push_back(0.0);
|
||||
@@ -78,7 +78,7 @@ G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
|
||||
binVector.push_back(theEmin);
|
||||
dataVector.push_back(0.0);
|
||||
|
||||
for (size_t i=1; i<numberOfNodes-1; i++)
|
||||
for (size_t i=1; i<numberOfNodes-1; ++i)
|
||||
{
|
||||
binVector.push_back(G4Exp((baseBin+i)*dBin));
|
||||
dataVector.push_back(0.0);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsLogVector.cc 74256 2013-10-02 14:24:02Z gcosmo $
|
||||
// $Id: G4PhysicsLogVector.cc 93409 2015-10-21 13:26:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -63,7 +63,7 @@ G4PhysicsLogVector::G4PhysicsLogVector(size_t theNbin)
|
||||
dataVector.reserve(numberOfNodes);
|
||||
binVector.reserve(numberOfNodes);
|
||||
|
||||
for (size_t i=0; i<numberOfNodes; i++)
|
||||
for (size_t i=0; i<numberOfNodes; ++i)
|
||||
{
|
||||
binVector.push_back(0.0);
|
||||
dataVector.push_back(0.0);
|
||||
@@ -86,7 +86,7 @@ G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
|
||||
binVector.push_back(theEmin);
|
||||
dataVector.push_back(0.0);
|
||||
|
||||
for (size_t i=1; i<numberOfNodes-1; i++)
|
||||
for (size_t i=1; i<numberOfNodes-1; ++i)
|
||||
{
|
||||
binVector.push_back(G4Exp((baseBin+i)*dBin));
|
||||
dataVector.push_back(0.0);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsOrderedFreeVector.cc 74256 2013-10-02 14:24:02Z gcosmo $
|
||||
// $Id: G4PhysicsOrderedFreeVector.cc 93409 2015-10-21 13:26:27Z gcosmo $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PhysicsOrderedFreeVector Class Implementation
|
||||
@@ -66,7 +66,7 @@ G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector(G4double *Energies,
|
||||
{
|
||||
type = T_G4PhysicsOrderedFreeVector;
|
||||
|
||||
for (size_t i = 0 ; i < VectorLength ; i++)
|
||||
for (size_t i = 0 ; i < VectorLength ; ++i)
|
||||
{
|
||||
InsertValues(Energies[i], Values[i]);
|
||||
}
|
||||
@@ -100,48 +100,48 @@ void G4PhysicsOrderedFreeVector::InsertValues(G4double energy, G4double value)
|
||||
binVector.insert(binLoc, energy);
|
||||
dataVector.insert(dataLoc, value);
|
||||
|
||||
numberOfNodes++;
|
||||
++numberOfNodes;
|
||||
edgeMin = binVector.front();
|
||||
edgeMax = binVector.back();
|
||||
}
|
||||
|
||||
G4double G4PhysicsOrderedFreeVector::GetEnergy(G4double aValue)
|
||||
G4double G4PhysicsOrderedFreeVector::GetEnergy(G4double aValue)
|
||||
{
|
||||
|
||||
G4double e;
|
||||
if (aValue <= GetMinValue()) {
|
||||
return GetMinLowEdgeEnergy();
|
||||
e = edgeMin;
|
||||
} else if (aValue >= GetMaxValue()) {
|
||||
return GetMaxLowEdgeEnergy();
|
||||
e = edgeMax;
|
||||
} else {
|
||||
size_t closestBin = FindValueBinLocation(aValue);
|
||||
G4double theEnergy = LinearInterpolationOfEnergy(aValue, closestBin);
|
||||
|
||||
return theEnergy;
|
||||
}
|
||||
size_t closestBin = FindValueBinLocation(aValue);
|
||||
e = LinearInterpolationOfEnergy(aValue, closestBin);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
size_t G4PhysicsOrderedFreeVector::FindValueBinLocation(G4double aValue)
|
||||
{
|
||||
G4int n1 = 0;
|
||||
G4int n2 = numberOfNodes/2;
|
||||
G4int n3 = numberOfNodes - 1;
|
||||
while (n1 != n3 - 1) {
|
||||
if (aValue > dataVector[n2])
|
||||
{ n1 = n2; }
|
||||
else
|
||||
{ n3 = n2; }
|
||||
n2 = n1 + (n3 - n1 + 1)/2;
|
||||
}
|
||||
return (size_t)n1;
|
||||
size_t bin = std::lower_bound(dataVector.begin(), dataVector.end(), aValue)
|
||||
- dataVector.begin() - 1;
|
||||
bin = std::min(bin, numberOfNodes-2);
|
||||
return bin;
|
||||
}
|
||||
|
||||
G4double G4PhysicsOrderedFreeVector::LinearInterpolationOfEnergy(G4double aValue,
|
||||
size_t theLocBin)
|
||||
size_t bin)
|
||||
{
|
||||
G4double intplFactor = (aValue-dataVector[theLocBin])
|
||||
/ (dataVector[theLocBin+1]-dataVector[theLocBin]); // Interpolation factor
|
||||
|
||||
return binVector[theLocBin] +
|
||||
( binVector[theLocBin+1]-binVector[theLocBin] ) * intplFactor;
|
||||
G4double res = binVector[bin];
|
||||
G4double del = dataVector[bin+1] - dataVector[bin];
|
||||
if(del > 0.0) {
|
||||
res += (aValue - dataVector[bin])*(binVector[bin+1] - res)/del;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void G4PhysicsOrderedFreeVector::DumpValues()
|
||||
{
|
||||
for (size_t i = 0; i < numberOfNodes; i++)
|
||||
{
|
||||
G4cout << binVector[i] << "\t" << dataVector[i] << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicsVector.cc 83009 2014-07-24 14:51:29Z gcosmo $
|
||||
// $Id: G4PhysicsVector.cc 93409 2015-10-21 13:26:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -56,8 +56,6 @@
|
||||
#include <iomanip>
|
||||
#include "G4PhysicsVector.hh"
|
||||
|
||||
//G4ThreadLocal G4Allocator<G4PhysicsVector> *fpPVAllocator = 0;
|
||||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
G4PhysicsVector::G4PhysicsVector(G4bool)
|
||||
@@ -67,7 +65,6 @@ G4PhysicsVector::G4PhysicsVector(G4bool)
|
||||
dBin(0.), baseBin(0.),
|
||||
verboseLevel(0)
|
||||
{
|
||||
// if (!fpPVAllocator) fpPVAllocator = new G4Allocator<G4PhysicsVector>;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
@@ -281,14 +278,10 @@ G4PhysicsVector::ScaleVector(G4double factorE, G4double factorV)
|
||||
{
|
||||
size_t n = dataVector.size();
|
||||
size_t i;
|
||||
if(n > 0) {
|
||||
for(i=0; i<n; ++i) {
|
||||
binVector[i] *= factorE;
|
||||
dataVector[i] *= factorV;
|
||||
}
|
||||
for(i=0; i<n; ++i) {
|
||||
binVector[i] *= factorE;
|
||||
dataVector[i] *= factorV;
|
||||
}
|
||||
// n = secDerivative.size();
|
||||
// if(n > 0) { for(i=0; i<n; ++i) { secDerivative[i] *= factorV; } }
|
||||
secDerivative.clear();
|
||||
|
||||
edgeMin *= factorE;
|
||||
@@ -523,22 +516,14 @@ G4double G4PhysicsVector::Value(G4double theEnergy, size_t& lastIdx) const
|
||||
G4double G4PhysicsVector::FindLinearEnergy(G4double rand) const
|
||||
{
|
||||
if(1 >= numberOfNodes) { return 0.0; }
|
||||
size_t n1 = 0;
|
||||
size_t n2 = numberOfNodes/2;
|
||||
size_t n3 = numberOfNodes - 1;
|
||||
G4double y = rand*dataVector[n3];
|
||||
while (n1 + 1 != n3)
|
||||
{
|
||||
if (y > dataVector[n2])
|
||||
{ n1 = n2; }
|
||||
else
|
||||
{ n3 = n2; }
|
||||
n2 = (n3 + n1 + 1)/2;
|
||||
}
|
||||
G4double res = binVector[n1];
|
||||
G4double del = dataVector[n3] - dataVector[n1];
|
||||
G4double y = rand*dataVector[numberOfNodes-1];
|
||||
size_t bin = std::lower_bound(dataVector.begin(), dataVector.end(), y)
|
||||
- dataVector.begin() - 1;
|
||||
bin = std::min(bin, numberOfNodes-2);
|
||||
G4double res = binVector[bin];
|
||||
G4double del = dataVector[bin+1] - dataVector[bin];
|
||||
if(del > 0.0) {
|
||||
res += (y - dataVector[n1])*(binVector[n3] - res)/del;
|
||||
res += (y - dataVector[bin])*(binVector[bin+1] - res)/del;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4Pow.cc 83383 2014-08-21 14:20:37Z gcosmo $
|
||||
// $Id: G4Pow.cc 93311 2015-10-16 10:16:37Z gcosmo $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -127,10 +127,11 @@ G4Pow::~G4Pow()
|
||||
|
||||
G4double G4Pow::powN(G4double x, G4int n) const
|
||||
{
|
||||
if(0.0 == x) { return 0.0; }
|
||||
if(std::abs(n) > 8) { return std::pow(x, G4double(n)); }
|
||||
G4double res = 1.0;
|
||||
if(n >= 0) { for(G4int i=0; i<n; ++i) { res *= x; } }
|
||||
else if((n < 0) && (x != 0.0))
|
||||
else if(n < 0)
|
||||
{
|
||||
G4double y = 1.0/x;
|
||||
G4int nn = -n;
|
||||
|
||||
@@ -80,6 +80,7 @@ G4int G4Threading::G4GetNumberOfCores()
|
||||
void G4Threading::G4SetThreadId(G4int value ) { G4ThreadID = value; }
|
||||
G4int G4Threading::G4GetThreadId() { return G4ThreadID; }
|
||||
G4bool G4Threading::IsWorkerThread() { return (G4ThreadID>=0); }
|
||||
G4bool G4Threading::IsMasterThread() { return (G4ThreadID==MASTER_ID); }
|
||||
|
||||
#if defined(WIN32) // WIN32 stuff needed for MT
|
||||
DWORD /*WINAPI*/ G4WaitForSingleObjectInf( __in G4Mutex m )
|
||||
@@ -126,6 +127,7 @@ G4Pid_t G4Threading::G4GetPidId()
|
||||
G4int G4Threading::G4GetNumberOfCores() { return 1; }
|
||||
G4int G4Threading::G4GetThreadId() { return G4Threading::SEQUENTIAL_ID; }
|
||||
G4bool G4Threading::IsWorkerThread() { return false; }
|
||||
G4bool G4Threading::IsMasterThread() { return true; }
|
||||
void G4Threading::G4SetThreadId(G4int) {}
|
||||
|
||||
G4bool G4Threading::G4SetPinAffinity(G4int,G4Thread&) { return true;}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnitsTable.cc 67970 2013-03-13 10:10:06Z gcosmo $
|
||||
// $Id: G4UnitsTable.cc 94074 2015-11-05 14:56:40Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//
|
||||
@@ -219,6 +219,11 @@ void G4UnitDefinition::BuildUnitsTable()
|
||||
new G4UnitDefinition( "meter3","m3" ,"Volume",meter3);
|
||||
new G4UnitDefinition("centimeter3","cm3" ,"Volume",centimeter3);
|
||||
new G4UnitDefinition("millimeter3","mm3" ,"Volume",millimeter3);
|
||||
|
||||
new G4UnitDefinition( "liter","L" ,"Volume",liter);
|
||||
new G4UnitDefinition( "dL","dL" ,"Volume",dL);
|
||||
new G4UnitDefinition( "cL","cL" ,"Volume",cL);
|
||||
new G4UnitDefinition( "mL","mL" ,"Volume",mL);
|
||||
|
||||
//Angle
|
||||
new G4UnitDefinition( "radian","rad" ,"Angle",radian);
|
||||
@@ -322,6 +327,7 @@ void G4UnitDefinition::BuildUnitsTable()
|
||||
|
||||
//Amount of substance
|
||||
new G4UnitDefinition("mole","mol","Amount of substance",mole);
|
||||
new G4UnitDefinition("g/mole","g/mol","Molar mass",g/mole);
|
||||
|
||||
//Activity
|
||||
new G4UnitDefinition("becquerel","Bq","Activity",becquerel);
|
||||
|
||||
Reference in New Issue
Block a user