Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -379,7 +379,9 @@ G4int G4AnalyticalPolSolver::QuarticRoots(G4double p[5], G4double r[3][5])
|
||||
reRoot[k] = r[1][k];
|
||||
}
|
||||
else
|
||||
{
|
||||
reRoot[k] = DBL_MAX; // kInfinity;
|
||||
}
|
||||
}
|
||||
y1 = DBL_MAX; // kInfinity;
|
||||
for(k = 1; k < 4; k++)
|
||||
|
||||
@@ -128,10 +128,9 @@ void G4ConvergenceTester::calStat()
|
||||
vov = 0.0;
|
||||
|
||||
G4double xi;
|
||||
for(auto it = nonzero_histories.cbegin(); it != nonzero_histories.cend();
|
||||
++it)
|
||||
for(const auto& nonzero_historie : nonzero_histories)
|
||||
{
|
||||
xi = it->second;
|
||||
xi = nonzero_historie.second;
|
||||
sum_x2 += xi * xi;
|
||||
var += (xi - mean) * (xi - mean);
|
||||
shift += (xi - mean) * (xi - mean) * (xi - mean);
|
||||
@@ -165,14 +164,14 @@ void G4ConvergenceTester::calStat()
|
||||
largest = 0.0;
|
||||
largest_score_happened = 0;
|
||||
G4double spend_time_of_largest = 0.0;
|
||||
for(auto it = nonzero_histories.cbegin(); it != nonzero_histories.cend();
|
||||
++it)
|
||||
for(const auto& nonzero_historie : nonzero_histories)
|
||||
{
|
||||
if(std::abs(it->second) > largest)
|
||||
if(std::abs(nonzero_historie.second) > largest)
|
||||
{
|
||||
largest = it->second;
|
||||
largest_score_happened = it->first;
|
||||
spend_time_of_largest = cpu_time[it->first + 1] - cpu_time[it->first];
|
||||
largest = nonzero_historie.second;
|
||||
largest_score_happened = nonzero_historie.first;
|
||||
spend_time_of_largest =
|
||||
cpu_time[nonzero_historie.first + 1] - cpu_time[nonzero_historie.first];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,10 +185,9 @@ void G4ConvergenceTester::calStat()
|
||||
|
||||
mean_1 = (sum + largest) / (n + 1);
|
||||
|
||||
for(auto it = nonzero_histories.cbegin(); it != nonzero_histories.cend();
|
||||
++it)
|
||||
for(const auto& nonzero_historie : nonzero_histories)
|
||||
{
|
||||
xi = it->second;
|
||||
xi = nonzero_historie.second;
|
||||
var_1 += (xi - mean_1) * (xi - mean_1);
|
||||
shift_1 += (xi - mean_1) * (xi - mean_1) * (xi - mean_1);
|
||||
vov_1 += (xi - mean_1) * (xi - mean_1) * (xi - mean_1) * (xi - mean_1);
|
||||
@@ -284,7 +282,9 @@ void G4ConvergenceTester::calc_stat_history()
|
||||
}
|
||||
|
||||
if(nonzero_till_ith == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mean_till_ith = mean_till_ith / (ith + 1);
|
||||
mean_history[i] = mean_till_ith;
|
||||
@@ -314,11 +314,17 @@ void G4ConvergenceTester::calc_stat_history()
|
||||
G4double sum_till_ith = mean_till_ith * (ith + 1);
|
||||
|
||||
if(!(std::fabs(var_till_ith) > 0.0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(!(std::fabs(mean_till_ith) > 0.0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(!(std::fabs(sum_till_ith) > 0.0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
vov_till_ith = vov_till_ith / std::pow(var_till_ith, 2.0) - 1.0 / (ith + 1);
|
||||
vov_history[i] = vov_till_ith;
|
||||
@@ -561,7 +567,7 @@ void G4ConvergenceTester::check_stat_history(std::ostream& out)
|
||||
out << "r does not follow 1/std::sqrt(N)" << G4endl;
|
||||
}
|
||||
|
||||
if(is_monotonically_decrease(second_ally) == true)
|
||||
if(is_monotonically_decrease(second_ally))
|
||||
{
|
||||
out << "r is monotonically decrease " << G4endl;
|
||||
}
|
||||
@@ -600,7 +606,7 @@ void G4ConvergenceTester::check_stat_history(std::ostream& out)
|
||||
out << "VOV does not follow 1/std::sqrt(N)" << G4endl;
|
||||
}
|
||||
|
||||
if(is_monotonically_decrease(second_ally) == true)
|
||||
if(is_monotonically_decrease(second_ally))
|
||||
{
|
||||
out << "VOV is monotonically decrease " << G4endl;
|
||||
}
|
||||
@@ -667,19 +673,21 @@ G4double G4ConvergenceTester::calc_Pearson_r(G4int N,
|
||||
}
|
||||
|
||||
G4bool G4ConvergenceTester::is_monotonically_decrease(
|
||||
std::vector<G4double> ally)
|
||||
const std::vector<G4double>& ally)
|
||||
{
|
||||
for(auto it = ally.cbegin(); it != ally.cend() - 1; ++it)
|
||||
{
|
||||
if(*it < *(it + 1))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
++noPass;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void G4ConvergenceTester::calc_slope_fit(std::vector<G4double>)
|
||||
void G4ConvergenceTester::calc_slope_fit(const std::vector<G4double>&)
|
||||
{
|
||||
// create PDF bins
|
||||
G4double max = largest_scores.front();
|
||||
|
||||
@@ -398,7 +398,9 @@ G4int G4DataInterpolation::LocateArgument(G4double pX) const
|
||||
return fNumber - 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kLow;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -49,11 +49,6 @@ G4GaussChebyshevQ::G4GaussChebyshevQ(function pFunction, G4int nChebyshev)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
|
||||
G4GaussChebyshevQ::~G4GaussChebyshevQ() {}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
//
|
||||
// Integrates function pointed by fFunction from a to b by Gauss-Chebyshev
|
||||
|
||||
@@ -41,10 +41,6 @@ const G4double G4JTPolynomialSolver::are = DBL_EPSILON;
|
||||
const G4double G4JTPolynomialSolver::mre = DBL_EPSILON;
|
||||
const G4double G4JTPolynomialSolver::lo = DBL_MIN / DBL_EPSILON;
|
||||
|
||||
G4JTPolynomialSolver::G4JTPolynomialSolver() {}
|
||||
|
||||
G4JTPolynomialSolver::~G4JTPolynomialSolver() {}
|
||||
|
||||
G4int G4JTPolynomialSolver::FindRoots(G4double* op, G4int degr, G4double* zeror,
|
||||
G4double* zeroi)
|
||||
{
|
||||
@@ -186,7 +182,7 @@ G4int G4JTPolynomialSolver::FindRoots(G4double* op, G4int degr, G4double* zeror,
|
||||
|
||||
// Chop the interval (0,x) until ff <= 0
|
||||
//
|
||||
while(1)
|
||||
while(true)
|
||||
{
|
||||
xm = x * 0.1;
|
||||
ff = pt[0];
|
||||
@@ -230,11 +226,11 @@ G4int G4JTPolynomialSolver::FindRoots(G4double* op, G4int degr, G4double* zeror,
|
||||
k[0] = p[0];
|
||||
aa = p[n];
|
||||
bb = p[n - 1];
|
||||
zerok = (k[n - 1] == 0);
|
||||
zerok = static_cast<G4int>(k[n - 1] == 0);
|
||||
for(jj = 0; jj < 5; ++jj)
|
||||
{
|
||||
cc = k[n - 1];
|
||||
if(!zerok) // Use a scaled form of recurrence if k at 0 is nonzero.
|
||||
if(zerok == 0) // Use a scaled form of recurrence if k at 0 is nonzero.
|
||||
{
|
||||
// Use a scaled form of recurrence if value of k at 0 is nonzero.
|
||||
//
|
||||
@@ -245,7 +241,8 @@ G4int G4JTPolynomialSolver::FindRoots(G4double* op, G4int degr, G4double* zeror,
|
||||
k[j] = t * k[j - 1] + p[j];
|
||||
}
|
||||
k[0] = p[0];
|
||||
zerok = (std::fabs(k[n - 1]) <= std::fabs(bb) * eta * 10.0);
|
||||
zerok =
|
||||
static_cast<G4int>(std::fabs(k[n - 1]) <= std::fabs(bb) * eta * 10.0);
|
||||
}
|
||||
else // Use unscaled form of recurrence.
|
||||
{
|
||||
@@ -255,7 +252,7 @@ G4int G4JTPolynomialSolver::FindRoots(G4double* op, G4int degr, G4double* zeror,
|
||||
k[j] = k[j - 1];
|
||||
}
|
||||
k[0] = 0.0;
|
||||
zerok = (!(k[n - 1] != 0.0));
|
||||
zerok = static_cast<G4int>(!(k[n - 1] != 0.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,9 +391,9 @@ void G4JTPolynomialSolver::ComputeFixedShiftPolynomial(G4int l2, G4int* nz)
|
||||
}
|
||||
|
||||
// Compare with convergence criteria.
|
||||
vpass = (tvv < betav);
|
||||
spass = (tss < betas);
|
||||
if(!(spass || vpass))
|
||||
vpass = static_cast<G4int>(tvv < betav);
|
||||
spass = static_cast<G4int>(tss < betas);
|
||||
if(!((spass != 0) || (vpass != 0)))
|
||||
{
|
||||
ovv = vv;
|
||||
oss = ss;
|
||||
@@ -420,7 +417,7 @@ void G4JTPolynomialSolver::ComputeFixedShiftPolynomial(G4int l2, G4int* nz)
|
||||
//
|
||||
vtry = 0;
|
||||
stry = 0;
|
||||
if((spass && (!vpass)) || (tss < tvv))
|
||||
if(((spass != 0) && (vpass == 0)) || (tss < tvv))
|
||||
{
|
||||
RealPolynomialIteration(&xs, nz, &iflag);
|
||||
if(*nz > 0)
|
||||
@@ -464,7 +461,7 @@ void G4JTPolynomialSolver::ComputeFixedShiftPolynomial(G4int l2, G4int* nz)
|
||||
// Try linear iteration if it has not been tried and
|
||||
// the S sequence is converging.
|
||||
//
|
||||
if(stry || !spass)
|
||||
if((stry != 0) || (spass == 0))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -509,7 +506,7 @@ void G4JTPolynomialSolver::ComputeFixedShiftPolynomial(G4int l2, G4int* nz)
|
||||
// Try quadratic iteration if it has not been tried
|
||||
// and the V sequence is converging.
|
||||
//
|
||||
if(vpass && !vtry)
|
||||
if((vpass != 0) && (vtry == 0))
|
||||
{
|
||||
goto _quadratic_iteration;
|
||||
}
|
||||
@@ -549,7 +546,7 @@ void G4JTPolynomialSolver::QuadraticPolynomialIteration(G4double* uu,
|
||||
|
||||
// Main loop.
|
||||
|
||||
while(1)
|
||||
while(true)
|
||||
{
|
||||
Quadratic(1.0, u, v, &szr, &szi, &lzr, &lzi);
|
||||
|
||||
@@ -599,7 +596,7 @@ void G4JTPolynomialSolver::QuadraticPolynomialIteration(G4double* uu,
|
||||
}
|
||||
if(j >= 2)
|
||||
{
|
||||
if(!(relstp > 0.01 || mp < omp || tried))
|
||||
if(!(relstp > 0.01 || mp < omp || (tried != 0)))
|
||||
{
|
||||
// A cluster appears to be stalling the convergence.
|
||||
// Five fixed shift steps are taken with a u,v close to the cluster.
|
||||
@@ -661,7 +658,7 @@ void G4JTPolynomialSolver::RealPolynomialIteration(G4double* sss, G4int* nz,
|
||||
|
||||
// Main loop
|
||||
//
|
||||
while(1)
|
||||
while(true)
|
||||
{
|
||||
pv = p[0];
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ G4SimpleIntegration::G4SimpleIntegration(function pFunction,
|
||||
, fTolerance(pTolerance)
|
||||
{}
|
||||
|
||||
G4SimpleIntegration::~G4SimpleIntegration() {}
|
||||
|
||||
// Simple integration methods
|
||||
|
||||
G4double G4SimpleIntegration::Trapezoidal(G4double xInitial, G4double xFinal,
|
||||
|
||||
@@ -44,8 +44,6 @@ void G4StatDouble::reset()
|
||||
m_scale = 1.;
|
||||
}
|
||||
|
||||
G4StatDouble::~G4StatDouble() {}
|
||||
|
||||
void G4StatDouble::fill(G4double value, G4double weight)
|
||||
{
|
||||
m_sum_wx += value * weight;
|
||||
|
||||
Reference in New Issue
Block a user