Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
# Category geometry History
|
||||
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-10 Gabriele Cosmo (geometry-V11-00-02)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-01-28 Ben Morgan (geometry-V11-00-01)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
|
||||
@@ -1,9 +1,39 @@
|
||||
# Category field History
|
||||
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-28 Gabriele Cosmo (field-V11-00-05)
|
||||
- Fixed restore of stream precision in G4FieldManager::ReportBadEpsilonValue().
|
||||
|
||||
## 2022-11-14 John Apostolakis (field-V11-00-04)
|
||||
- Revised G4FieldManager to ensure that epsilon_min / _max parameters
|
||||
are less than a 'maximum accepted' accuracy (now=0.02) to ensure robust
|
||||
behaviour of the integration. Improved their Set methods, adding
|
||||
- warnings if min > max, with corrective behaviour, and
|
||||
- a fatal exception in case of values outside the accepted range.
|
||||
|
||||
To cope with needs of legacy applications or existing needs for performance,
|
||||
the value of the 'ceiling' maximum accepted accuracy can be modified using
|
||||
the new static method
|
||||
G4FieldManager::SetMaxAcceptedEpsilon( maxAccept, softFail);
|
||||
but must remain under or equal to a final ceiling currently of
|
||||
fMaxFinalEpsilon=0.03
|
||||
|
||||
## 2022-11-10 Gabriele Cosmo (field-V11-00-03)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-05 Divyansh Tiwari, John Apostolakis (field-V11-00-02)
|
||||
|
||||
- Introduced G4BorisScheme and G4BorisDriver, a 2nd order symplectic
|
||||
integration method, created as part of GSoC 2022.
|
||||
|
||||
## 2022-10-05 Gabriele Cosmo (field-V11-00-01)
|
||||
- Fixed compilation warnings on Intel/icx compiler for variables set
|
||||
but not used.
|
||||
|
||||
## 2021-12-10 Ben Morgan (field-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4BorisDriver
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// G4BorisDriver is a driver class using the second order Boris
|
||||
// method to integrate the equation of motion.
|
||||
//
|
||||
//
|
||||
// Author: Divyansh Tiwari, Google Summer of Code 2022
|
||||
// Supervision: John Apostolakis,Renee Fatemi, Soon Yung Jun
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4BORIS_DRIVER_HH
|
||||
#define G4BORIS_DRIVER_HH
|
||||
|
||||
#include "G4VIntegrationDriver.hh"
|
||||
#include "G4BorisScheme.hh"
|
||||
#include "G4ChordFinderDelegate.hh"
|
||||
|
||||
|
||||
class G4BorisDriver:
|
||||
public G4VIntegrationDriver,
|
||||
public G4ChordFinderDelegate<G4BorisDriver>
|
||||
{
|
||||
public:
|
||||
|
||||
G4BorisDriver( G4double hminimum,
|
||||
G4BorisScheme* Boris,
|
||||
G4int numberOfComponents = 6,
|
||||
bool verbosity = false);
|
||||
|
||||
inline ~G4BorisDriver() = default;
|
||||
|
||||
inline G4BorisDriver(const G4BorisDriver&) = delete;
|
||||
inline G4BorisDriver& operator=(const G4BorisDriver&) = delete;
|
||||
|
||||
// 1. Core methods that advance the integration
|
||||
virtual G4bool AccurateAdvance( G4FieldTrack& track,
|
||||
G4double stepLen,
|
||||
G4double epsilon,
|
||||
G4double beginStep = 0) override;
|
||||
// Advance integration accurately - by relative accuracy better than 'epsilon'
|
||||
|
||||
virtual G4bool QuickAdvance( G4FieldTrack& y_val, // In/Out
|
||||
const G4double dydx[],
|
||||
G4double hstep,
|
||||
G4double& missDist, // Out: estimated sagitta
|
||||
G4double& dyerr ) override;
|
||||
// Attempt one integration step, and return estimated error 'dyerr'
|
||||
|
||||
void OneGoodStep(G4double yCurrentState[], // In/Out: state ('y')
|
||||
G4double& curveLength, // In/Out: 'x'
|
||||
G4double htry, // step to attempt
|
||||
G4double epsilon_rel, // relative accuracy
|
||||
G4double restMass,
|
||||
G4double charge,
|
||||
G4double& hdid, // Out: step achieved
|
||||
G4double& hnext); // Out: proposed next step
|
||||
// Method to implement Accurate Advance
|
||||
|
||||
// 2. Methods needed to co-work with G4ChordFinder
|
||||
virtual G4double AdvanceChordLimited(G4FieldTrack& track,
|
||||
G4double hstep,
|
||||
G4double eps,
|
||||
G4double chordDistance) override
|
||||
{
|
||||
return ChordFinderDelegate::
|
||||
AdvanceChordLimitedImpl(track, hstep, eps, chordDistance);
|
||||
}
|
||||
|
||||
virtual void OnStartTracking() override {
|
||||
ChordFinderDelegate::ResetStepEstimate();
|
||||
}
|
||||
|
||||
virtual void OnComputeStep() override {};
|
||||
|
||||
|
||||
|
||||
// 3. Does the method redo integrations when called to obtain values
|
||||
// for internal, smaller intervals ?
|
||||
// (when needed to identify an intersection.)
|
||||
virtual G4bool DoesReIntegrate() const override { return true; }
|
||||
// It would be no if it just used interpolation to provide a result.
|
||||
|
||||
// 4. Relevant for calculating a new step size to achieve required accuracy
|
||||
inline virtual G4double ComputeNewStepSize(
|
||||
G4double errMaxNorm, // normalised error
|
||||
G4double hstepCurrent) override; // current step size
|
||||
|
||||
G4double ShrinkStepSize2(G4double h, G4double error2) const;
|
||||
G4double GrowStepSize2(G4double h, G4double error2) const;
|
||||
// Calculate the next step size given the square of the relative error
|
||||
|
||||
// 5. Auxiliary Methods ...
|
||||
virtual void GetDerivatives( const G4FieldTrack& track,
|
||||
G4double dydx[]) const override;
|
||||
|
||||
virtual void GetDerivatives( const G4FieldTrack& track,
|
||||
G4double dydx[],
|
||||
G4double field[]) const override;
|
||||
|
||||
inline virtual void SetVerboseLevel(G4int level) override;
|
||||
inline virtual G4int GetVerboseLevel() const override;
|
||||
|
||||
inline virtual G4EquationOfMotion* GetEquationOfMotion() override;
|
||||
inline const G4EquationOfMotion* GetEquationOfMotion() const;
|
||||
virtual void SetEquationOfMotion(G4EquationOfMotion* equation) override;
|
||||
|
||||
virtual void StreamInfo( std::ostream& os ) const override;
|
||||
// Write out the parameters / state of the driver
|
||||
|
||||
// 6. Not relevant for Boris and other non-RK methods
|
||||
inline virtual const G4MagIntegratorStepper* GetStepper() const override;
|
||||
inline virtual G4MagIntegratorStepper* GetStepper() override;
|
||||
|
||||
private:
|
||||
inline G4int GetNumberOfVariables() const;
|
||||
|
||||
inline void CheckStep(const G4ThreeVector& posIn,
|
||||
const G4ThreeVector& posOut,
|
||||
G4double hdid) const;
|
||||
|
||||
private:
|
||||
// INVARIANTS -- remain unchanged during tracking / integration
|
||||
// Parameters
|
||||
G4double fMinimumStep;
|
||||
bool fVerbosity;
|
||||
|
||||
// State -- The core stepping algorithm
|
||||
G4BorisScheme* boris;
|
||||
|
||||
// STATE -- intermediate state (to avoid creation / churn )
|
||||
G4double yIn[G4FieldTrack::ncompSVEC],
|
||||
yMid[G4FieldTrack::ncompSVEC],
|
||||
yOut[G4FieldTrack::ncompSVEC],
|
||||
yError[G4FieldTrack::ncompSVEC];
|
||||
|
||||
G4double yCurrent[G4FieldTrack::ncompSVEC];
|
||||
|
||||
// - Unused 2022.11.03:
|
||||
// G4double derivs[2][6][G4FieldTrack::ncompSVEC];
|
||||
// const G4int interval_sequence[2];
|
||||
|
||||
// INVARIANTS -- Parameters for ensuring that one call has finite number of integration steps
|
||||
static constexpr int fMaxNoSteps = 300;
|
||||
static constexpr G4double fSmallestFraction= 1e-12; // To avoid FP underflow ! ( 1.e-6 for single prec)
|
||||
|
||||
static constexpr G4int fIntegratorOrder= 2; // 2nd order method -- needed for error control
|
||||
static constexpr G4double fSafetyFactor = 0.9; //
|
||||
|
||||
static constexpr G4double fMaxSteppingIncrease= 10.0; // Increase no more than 10x
|
||||
static constexpr G4double fMaxSteppingDecrease= 0.1; // Reduce no more than 10x
|
||||
static constexpr G4double fPowerShrink = -1.0 / fIntegratorOrder;
|
||||
static constexpr G4double fPowerGrow = -1.0 / (1.0 + fIntegratorOrder);
|
||||
|
||||
static const G4double fErrorConstraintShrink;
|
||||
static const G4double fErrorConstraintGrow;
|
||||
|
||||
using ChordFinderDelegate =
|
||||
G4ChordFinderDelegate<G4BorisDriver>;
|
||||
};
|
||||
|
||||
#include "G4BorisDriver.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4BorisDriver inline methods implementation
|
||||
|
||||
// Author: Divyansh Tiwari, Google Summer of Code 2022
|
||||
// Supervision: John Apostolakis,Renee Fatemi, Soon Yung Jun
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
void G4BorisDriver::SetVerboseLevel(G4int level)
|
||||
{
|
||||
fVerbosity = level;
|
||||
}
|
||||
|
||||
G4int G4BorisDriver::GetVerboseLevel() const
|
||||
{
|
||||
return fVerbosity;
|
||||
}
|
||||
|
||||
G4double G4BorisDriver::ComputeNewStepSize( G4double /* errMaxNorm*/, G4double hstepCurrent)
|
||||
{
|
||||
return hstepCurrent;
|
||||
}
|
||||
|
||||
const G4EquationOfMotion* G4BorisDriver::GetEquationOfMotion() const
|
||||
{
|
||||
auto eq = boris->GetEquationOfMotion();
|
||||
return eq;
|
||||
}
|
||||
|
||||
G4EquationOfMotion* G4BorisDriver::GetEquationOfMotion()
|
||||
{
|
||||
auto eq = boris->GetEquationOfMotion();
|
||||
return eq;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// #ifdef G4USE_SET_EQUATION_OF_MOTION
|
||||
void G4BorisDriver::
|
||||
SetEquationOfMotion( G4EquationOfMotion* equation )
|
||||
{
|
||||
boris->SetEquationOfMotion(equation);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4int G4BorisDriver::GetNumberOfVariables() const
|
||||
{
|
||||
return boris->GetNumberOfVariables();
|
||||
}
|
||||
|
||||
const G4MagIntegratorStepper*
|
||||
G4BorisDriver::GetStepper() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
G4MagIntegratorStepper*
|
||||
G4BorisDriver::GetStepper()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void G4BorisDriver::CheckStep(const G4ThreeVector& posIn,
|
||||
const G4ThreeVector& posOut,
|
||||
G4double hdid) const
|
||||
{
|
||||
const G4double endPointDist = (posOut - posIn).mag();
|
||||
if (endPointDist >= hdid * (1. + CLHEP::perMillion))
|
||||
{
|
||||
// ++fNoAccurateAdvanceBadSteps;
|
||||
// #ifdef G4DEBUG_FIELD
|
||||
// Issue a warning only for gross differences -
|
||||
// we understand how small difference occur.
|
||||
if (endPointDist >= hdid * (1. + CLHEP::perThousand))
|
||||
{
|
||||
G4Exception("G4BorisDriver::CheckStep()",
|
||||
"GeomField1002", JustWarning,
|
||||
"endPointDist >= hdid!");
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "G4BorisDriver::CheckStep: moved further than curve distance! "
|
||||
<< " curve hdid= " << hdid << " endpoint dist= " << endPointDist
|
||||
<< " ratio - 1 = " << (endPointDist - hdid) / hdid
|
||||
<< " ( > 1.0e-6 threshold to report ) "
|
||||
<< G4endl;
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// ++fNoAccurateAdvanceGoodSteps;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4BorisScheme
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Implementation of the Boris algorithm for advancing
|
||||
// charged particles in an electromagnetic field.
|
||||
|
||||
// Author: Divyansh Tiwari, Google Summer of Code 2022
|
||||
// Supervision: John Apostolakis,Renee Fatemi, Soon Yung Jun
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4BORIS_SCHEME_HH
|
||||
#define G4BORIS_SCHEME_HH
|
||||
|
||||
class G4EquationOfMotion;
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
|
||||
// class G4EqMagElectricField;
|
||||
|
||||
// #include "G4FieldTrack.hh"
|
||||
|
||||
#include <CLHEP/Units/PhysicalConstants.h>
|
||||
|
||||
class G4BorisScheme
|
||||
{
|
||||
public:
|
||||
|
||||
G4BorisScheme() = default;
|
||||
G4BorisScheme( // G4EqMagElectricField
|
||||
G4EquationOfMotion* equation,
|
||||
G4int nvar = 6);
|
||||
~G4BorisScheme() = default;
|
||||
|
||||
void DoStep( G4double restMass, G4double charge, const G4double yIn[],
|
||||
G4double yOut[], G4double hstep) const;
|
||||
|
||||
protected:
|
||||
// Used to implement the 'DoStep' method above
|
||||
void UpdatePosition(const G4double restMass, const G4double charge, const G4double yIn[],
|
||||
G4double yOut[], G4double hstep) const;
|
||||
|
||||
void UpdateVelocity(const G4double restMass, const G4double charge, const G4double yIn[],
|
||||
G4double yOut[], G4double hstep) const;
|
||||
|
||||
public:
|
||||
// - Methods using the Boris Scheme Stepping to estimate integration error
|
||||
void StepWithErrorEstimate(const G4double yIn[], G4double restMass, G4double charge, G4double hstep,
|
||||
G4double yOut[], G4double yErr[]) const;
|
||||
// Use two half-steps (comparing to a full step) to obtain output and error estimate
|
||||
|
||||
void StepWithMidAndErrorEstimate(const G4double yIn[], G4double restMass, G4double charge, G4double hstep,
|
||||
G4double yMid[], G4double yOut[], G4double yErr[]) const;
|
||||
// Same, and also return mid-point evaluation
|
||||
|
||||
// Auxiliary method
|
||||
inline G4EquationOfMotion* GetEquationOfMotion();
|
||||
// inline void SetEquationOfMotion(G4EquationOfMotion* equation); // Un-needed, dangerous
|
||||
|
||||
inline G4int GetNumberOfVariables() const;
|
||||
|
||||
private:
|
||||
|
||||
void copy(G4double dst[], const G4double src[]) const;
|
||||
|
||||
private:
|
||||
|
||||
G4EquationOfMotion* fEquation = nullptr;
|
||||
G4int fnvar = 8;
|
||||
static constexpr G4double c_l = CLHEP::c_light/CLHEP::m*CLHEP::second;
|
||||
};
|
||||
|
||||
#include "G4BorisScheme.icc"
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4BorisScheme inline methods implementation
|
||||
//
|
||||
// Author: Divyansh Tiwari, Google Summer of Code 2022
|
||||
// Supervision: John Apostolakis,Renee Fatemi, Soon Yung Jun
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
inline void G4BorisScheme::SetEquationOfMotion(G4EquationOfMotion* eq)
|
||||
{
|
||||
fEquation = eq;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline G4EquationOfMotion* G4BorisScheme::GetEquationOfMotion()
|
||||
{
|
||||
return fEquation;
|
||||
}
|
||||
|
||||
inline G4int G4BorisScheme::GetNumberOfVariables() const
|
||||
{
|
||||
return fnvar;
|
||||
}
|
||||
@@ -74,10 +74,10 @@ class G4BulirschStoer
|
||||
|
||||
const static G4int m_k_max = 8;
|
||||
|
||||
void extrapolate(size_t k, G4double xest[]);
|
||||
G4double calc_h_opt(G4double h, G4double error, size_t k) const;
|
||||
void extrapolate(std::size_t k, G4double xest[]);
|
||||
G4double calc_h_opt(G4double h, G4double error, std::size_t k) const;
|
||||
|
||||
G4bool set_k_opt(size_t k, G4double& dt);
|
||||
G4bool set_k_opt(std::size_t k, G4double& dt);
|
||||
G4bool in_convergence_window(G4int k) const;
|
||||
G4bool should_reject(G4double error, G4int k) const;
|
||||
|
||||
|
||||
@@ -173,13 +173,10 @@ OneGoodStep(G4double y[],
|
||||
// Set stepsize to the initial trial value
|
||||
G4double hstep = htry;
|
||||
|
||||
static G4ThreadLocal G4int tot_no_trials = 0;
|
||||
const G4int max_trials = 100;
|
||||
|
||||
for (G4int iter = 0; iter < max_trials; ++iter)
|
||||
{
|
||||
++tot_no_trials;
|
||||
|
||||
Base::GetStepper()->Stepper(y, dydx, hstep, yOut, yError, dydxOut);
|
||||
error2 = field_utils::relativeError2(y, yError, hstep, eps_rel_max);
|
||||
|
||||
|
||||
@@ -156,11 +156,11 @@ class G4FieldManager
|
||||
// Set accuracy of intersection of a volume. (only)
|
||||
|
||||
inline G4double GetMinimumEpsilonStep() const;
|
||||
inline void SetMinimumEpsilonStep( G4double newEpsMin );
|
||||
G4bool SetMinimumEpsilonStep( G4double newEpsMin );
|
||||
// Minimum for Relative accuracy of a Step
|
||||
|
||||
inline G4double GetMaximumEpsilonStep() const;
|
||||
inline void SetMaximumEpsilonStep( G4double newEpsMax );
|
||||
G4bool SetMaximumEpsilonStep( G4double newEpsMax );
|
||||
// Maximum for Relative accuracy of a Step
|
||||
|
||||
inline G4bool DoesFieldChangeEnergy() const;
|
||||
@@ -171,6 +171,23 @@ class G4FieldManager
|
||||
virtual G4FieldManager* Clone() const;
|
||||
// Needed for multi-threading, create a clone of this object
|
||||
|
||||
public:
|
||||
static G4double GetMaxAcceptedEpsilon();
|
||||
static G4bool SetMaxAcceptedEpsilon(G4double maxEps, G4bool softFail= false);
|
||||
// Set value -- within limits.
|
||||
// If it fails, with softFail=true it gives Warning, else FatalException
|
||||
|
||||
protected:
|
||||
static G4double fMaxAcceptedEpsilon;
|
||||
static constexpr G4double fMinAcceptedEpsilon= 1000.0 * std::numeric_limits<G4double>::epsilon();
|
||||
// Epsilon_min/max values must be smaller than this - for robust integration
|
||||
|
||||
static constexpr G4double fMaxWarningEpsilon= 0.001; // Setting larger value will give warning.
|
||||
static constexpr G4double fMaxFinalEpsilon= 0.02; // Will not accept larger values
|
||||
|
||||
static G4bool fVerboseConstruction;
|
||||
// Control verbosity of constructors
|
||||
|
||||
private:
|
||||
|
||||
void InitialiseFieldChangesEnergy();
|
||||
@@ -178,7 +195,11 @@ class G4FieldManager
|
||||
// and sets the data member accordingly
|
||||
// Note: does not handle special cases - this must be done
|
||||
// separately (e.g. magnetic monopole in B field )
|
||||
|
||||
|
||||
protected:
|
||||
void ReportBadEpsilonValue(G4ExceptionDescription& erm, G4double value,
|
||||
G4String& name) const;
|
||||
|
||||
private:
|
||||
|
||||
G4Field* fDetectorField = nullptr;
|
||||
|
||||
@@ -109,15 +109,6 @@ G4double G4FieldManager::GetMinimumEpsilonStep() const
|
||||
return fEpsilonMin;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4FieldManager::SetMinimumEpsilonStep( G4double newEpsMin )
|
||||
{
|
||||
if( (newEpsMin > 0.0) && (std::fabs(1.0+newEpsMin) > 1.0) )
|
||||
{
|
||||
fEpsilonMin = newEpsMin;
|
||||
}
|
||||
}
|
||||
|
||||
// Maximum for Relative accuracy of any Step
|
||||
//
|
||||
inline
|
||||
@@ -126,17 +117,6 @@ G4double G4FieldManager::GetMaximumEpsilonStep() const
|
||||
return fEpsilonMax;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4FieldManager::SetMaximumEpsilonStep( G4double newEpsMax )
|
||||
{
|
||||
if( (newEpsMax > 0.0)
|
||||
&& (newEpsMax >= fEpsilonMin )
|
||||
&& (std::fabs(1.0+newEpsMax)>1.0) )
|
||||
{
|
||||
fEpsilonMax = newEpsMax;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
void G4FieldManager::ChangeDetectorField(G4Field* detectorField)
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace field_utils
|
||||
TargetArray& trg, TargetArrays&... trgs);
|
||||
|
||||
void copy(G4double dst[], const G4double src[],
|
||||
size_t size = G4FieldTrack::ncompSVEC);
|
||||
std::size_t size = G4FieldTrack::ncompSVEC);
|
||||
|
||||
G4double inverseCurvatureRadius(G4double particleCharge,
|
||||
G4double momentum, G4double BField);
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace field_utils {
|
||||
namespace internal
|
||||
{
|
||||
template<class T>
|
||||
size_t getFirstIndex(const T& value)
|
||||
std::size_t getFirstIndex(const T& value)
|
||||
{
|
||||
return static_cast<size_t>(value);
|
||||
return static_cast<std::size_t>(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,9 +124,7 @@ AccurateAdvance(G4FieldTrack& track, G4double hstep,
|
||||
G4double hnext, hdid;
|
||||
|
||||
G4double dydx[G4FieldTrack::ncompSVEC];
|
||||
G4bool succeeded = true, lastStepSucceeded;
|
||||
|
||||
G4int noFullIntegr = 0, noSmallIntegr = 0;
|
||||
G4bool succeeded = true;
|
||||
|
||||
G4double y[G4FieldTrack::ncompSVEC];
|
||||
track.DumpToArray(y);
|
||||
@@ -154,7 +152,6 @@ AccurateAdvance(G4FieldTrack& track, G4double hstep,
|
||||
if (h > GetMinimumStep())
|
||||
{
|
||||
OneGoodStep(y, dydx, curveLength, h, eps, hdid, hnext);
|
||||
lastStepSucceeded = (hdid == h);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -177,12 +174,8 @@ AccurateAdvance(G4FieldTrack& track, G4double hstep,
|
||||
hdid = h;
|
||||
curveLength += hdid;
|
||||
hnext = Base::ComputeNewStepSize(dyerr / eps, h);
|
||||
lastStepSucceeded = (dyerr <= eps);
|
||||
}
|
||||
|
||||
if (lastStepSucceeded) { ++noFullIntegr; }
|
||||
else { ++noSmallIntegr; }
|
||||
|
||||
const G4ThreeVector EndPos =
|
||||
field_utils::makeVector(y, field_utils::Value3D::Position);
|
||||
|
||||
@@ -240,13 +233,10 @@ void G4IntegrationDriver<T>::OneGoodStep(G4double y[], // InOut
|
||||
|
||||
G4double h = htry;
|
||||
|
||||
static G4ThreadLocal G4int tot_no_trials = 0;
|
||||
const G4int max_trials = 100;
|
||||
|
||||
for (G4int iter = 0; iter < max_trials; ++iter)
|
||||
{
|
||||
tot_no_trials++;
|
||||
|
||||
Base::GetStepper()->Stepper(y, dydx, h, ytemp, yerr);
|
||||
error2 = field_utils::relativeError2(y, yerr, std::max(h, fMinimumStep),
|
||||
eps_rel_max);
|
||||
|
||||
@@ -6,6 +6,10 @@ geant4_add_module(G4magneticfield
|
||||
G4BFieldIntegrationDriver.hh
|
||||
G4BogackiShampine23.hh
|
||||
G4BogackiShampine45.hh
|
||||
G4BorisScheme.hh
|
||||
G4BorisScheme.icc
|
||||
G4BorisDriver.hh
|
||||
G4BorisDriver.icc
|
||||
G4BulirschStoer.hh
|
||||
G4BulirschStoer.icc
|
||||
G4BulirschStoerDriver.hh
|
||||
@@ -115,6 +119,8 @@ geant4_add_module(G4magneticfield
|
||||
G4BFieldIntegrationDriver.cc
|
||||
G4BogackiShampine23.cc
|
||||
G4BogackiShampine45.cc
|
||||
G4BorisDriver.cc
|
||||
G4BorisScheme.cc
|
||||
G4BulirschStoer.cc
|
||||
G4CachedMagneticField.cc
|
||||
G4CashKarpRKF45.cc
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4BorisDriver
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// G4BorisDriver is a driver class using the second order Boris
|
||||
// method to integrate the equation of motion.
|
||||
//
|
||||
//
|
||||
// Author: Divyansh Tiwari, Google Summer of Code 2022
|
||||
// Supervision: John Apostolakis,Renee Fatemi, Soon Yung Jun
|
||||
// --------------------------------------------------------------------
|
||||
#include <cassert>
|
||||
|
||||
#include "G4BorisDriver.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4LineSection.hh"
|
||||
#include "G4FieldUtils.hh"
|
||||
|
||||
const G4double G4BorisDriver::fErrorConstraintShrink = std::pow(
|
||||
fMaxSteppingDecrease / fSafetyFactor, 1. / fPowerShrink);
|
||||
|
||||
const G4double G4BorisDriver::fErrorConstraintGrow = std::pow(
|
||||
fMaxSteppingIncrease / fSafetyFactor, 1. / fPowerGrow);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
G4BorisDriver::
|
||||
G4BorisDriver( G4double hminimum, G4BorisScheme* Boris,
|
||||
G4int numberOfComponents, bool verbosity )
|
||||
: fMinimumStep(hminimum),
|
||||
fVerbosity(verbosity),
|
||||
boris(Boris)
|
||||
// , interval_sequence{2,4}
|
||||
{
|
||||
assert(boris->GetNumberOfVariables() == numberOfComponents);
|
||||
|
||||
if(boris->GetNumberOfVariables() != numberOfComponents)
|
||||
{
|
||||
std::ostringstream msg;
|
||||
msg << "Disagreement in number of variables = "
|
||||
<< boris->GetNumberOfVariables()
|
||||
<< " vs no of components = " << numberOfComponents;
|
||||
G4Exception("G4BorisDriver Constructor:",
|
||||
"GeomField1001", FatalException, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
G4bool G4BorisDriver::AccurateAdvance( G4FieldTrack& track,
|
||||
G4double hstep,
|
||||
G4double epsilon,
|
||||
G4double hinitial )
|
||||
{
|
||||
// Specification: Driver with adaptive stepsize control.
|
||||
// Integrate starting values at y_current over hstep x2 with (relative) accuracy 'eps'.
|
||||
// On output 'track' is replaced by values at the end of the integration interval.
|
||||
|
||||
// Ensure that hstep > 0
|
||||
if(hstep == 0)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Proposed step is zero; hstep = " << hstep << " !";
|
||||
G4Exception("G4BorisDriver::AccurateAdvance()",
|
||||
"GeomField1001", JustWarning, message);
|
||||
return true;
|
||||
}
|
||||
if(hstep < 0)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid run condition." << G4endl
|
||||
<< "Proposed step is negative; hstep = " << hstep << G4endl
|
||||
<< "Requested step cannot be negative! Aborting event.";
|
||||
G4Exception("G4BorisDriver::AccurateAdvance()",
|
||||
"GeomField0003", EventMustBeAborted, message);
|
||||
return false;
|
||||
}
|
||||
|
||||
if( hinitial == 0.0 ) { hinitial = hstep; }
|
||||
if( hinitial < 0.0 ) { hinitial = std::fabs( hinitial ); }
|
||||
// G4double htrial = std::min( hstep, hinitial );
|
||||
G4double htrial = hstep;
|
||||
// Decide first step size
|
||||
|
||||
// G4int noOfSteps = h/hstep;
|
||||
|
||||
// integration variables
|
||||
//
|
||||
track.DumpToArray(yCurrent);
|
||||
|
||||
const G4double restMass = track.GetRestMass();
|
||||
const G4double charge = track.GetCharge()*e_SI;
|
||||
const G4int nvar= GetNumberOfVariables();
|
||||
|
||||
// copy non-integration variables to out array
|
||||
//
|
||||
std::memcpy(yOut + nvar,
|
||||
yCurrent + nvar,
|
||||
sizeof(G4double)*(G4FieldTrack::ncompSVEC-nvar));
|
||||
|
||||
G4double curveLength = track.GetCurveLength(); // starting value
|
||||
const G4double endCurveLength = curveLength + hstep;
|
||||
|
||||
// -- Initial version: Did it in one step -- did not account for errors !!!
|
||||
// G4FieldTrack yFldTrk(track);
|
||||
// yFldTrk.LoadFromArray(yCurrent, G4FieldTrack::ncompSVEC);
|
||||
// yFldTrk.SetCurveLength(curveLength);
|
||||
// G4double dchord_step, dyerr_len;
|
||||
// QuickAdvance(yFldTrk, dydxCurrent, htrial, dchord_step, dyerr_len);
|
||||
|
||||
const G4double hThreshold =
|
||||
std::max(epsilon * hstep, fSmallestFraction * curveLength);
|
||||
|
||||
G4double htry= htrial;
|
||||
|
||||
for (G4int nstp = 0; nstp < fMaxNoSteps; ++nstp)
|
||||
{
|
||||
G4double hdid= 0.0, hnext=0.0;
|
||||
|
||||
OneGoodStep(yCurrent, curveLength, htry, epsilon, restMass, charge, hdid, hnext);
|
||||
//*********
|
||||
|
||||
// Simple check: move (distance of displacement) is smaller than length along curve!
|
||||
const G4ThreeVector StartPos = field_utils::makeVector(yCurrent, field_utils::Value3D::Position);
|
||||
const G4ThreeVector EndPos = field_utils::makeVector(yCurrent, field_utils::Value3D::Position);
|
||||
CheckStep(EndPos, StartPos, hdid);
|
||||
|
||||
// Check 1. for finish and 2. *avoid* numerous small last steps
|
||||
if (curveLength >= endCurveLength || htry < hThreshold)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
htry = std::max(hnext, fMinimumStep);
|
||||
if (curveLength + htry > endCurveLength)
|
||||
{
|
||||
htry = endCurveLength - curveLength;
|
||||
}
|
||||
}
|
||||
|
||||
// upload new state
|
||||
track.LoadFromArray(yCurrent, G4FieldTrack::ncompSVEC);
|
||||
track.SetCurveLength(curveLength);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
void G4BorisDriver::OneGoodStep(G4double y[], // InOut
|
||||
G4double& curveLength, // InOut
|
||||
G4double htry,
|
||||
G4double epsilon_rel,
|
||||
G4double restMass,
|
||||
G4double charge,
|
||||
G4double& hdid, // Out
|
||||
G4double& hnext) // Out
|
||||
{
|
||||
G4double error2 = DBL_MAX;
|
||||
G4double yerr[G4FieldTrack::ncompSVEC], ytemp[G4FieldTrack::ncompSVEC];
|
||||
|
||||
G4double h = htry;
|
||||
|
||||
const G4int max_trials = 100;
|
||||
|
||||
for (G4int iter = 0; iter < max_trials; ++iter)
|
||||
{
|
||||
boris->StepWithErrorEstimate(y, restMass, charge, h, ytemp, yerr);
|
||||
|
||||
error2 = field_utils::relativeError2(y, yerr, std::max(h, fMinimumStep),
|
||||
epsilon_rel);
|
||||
if (error2 <= 1.0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
h = ShrinkStepSize2(h, error2);
|
||||
|
||||
G4double xnew = curveLength + h;
|
||||
if(xnew == curveLength)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Stepsize underflow in Stepper !" << G4endl
|
||||
<< "- Step's start x=" << curveLength
|
||||
<< " and end x= " << xnew
|
||||
<< " are equal !! " << G4endl
|
||||
<< " Due to step-size= " << h
|
||||
<< ". Note that input step was " << htry;
|
||||
G4Exception("G4IntegrationDriver::OneGoodStep()",
|
||||
"GeomField1001", JustWarning, message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hnext = GrowStepSize2(h, error2);
|
||||
curveLength += (hdid = h);
|
||||
|
||||
field_utils::copy(y, ytemp, GetNumberOfVariables());
|
||||
}
|
||||
|
||||
// ===========------------------------------------------------------===========
|
||||
|
||||
G4bool G4BorisDriver::
|
||||
QuickAdvance( G4FieldTrack& track, const G4double /*dydx*/[],
|
||||
G4double hstep, G4double& missDist, G4double& dyerr)
|
||||
{
|
||||
const auto nvar = boris->GetNumberOfVariables();
|
||||
|
||||
track.DumpToArray(yIn);
|
||||
const G4double curveLength = track.GetCurveLength();
|
||||
|
||||
// call the boris method for step length hstep
|
||||
G4double restMass = track.GetRestMass();
|
||||
G4double charge = track.GetCharge()*e_SI;
|
||||
|
||||
// boris->DoStep(restMass, charge, yIn, yMid, hstep*0.5);
|
||||
// boris->DoStep(restMass, charge, yMid, yOut, hstep*0.5); // Use mid-point !!
|
||||
boris->StepWithMidAndErrorEstimate(yIn, restMass, charge, hstep,
|
||||
yMid, yOut, yError);
|
||||
// Same, and also return mid-point evaluation
|
||||
|
||||
// How to calculate chord length??
|
||||
const auto mid = field_utils::makeVector(yMid,
|
||||
field_utils::Value3D::Position);
|
||||
const auto in = field_utils::makeVector(yIn,
|
||||
field_utils::Value3D::Position);
|
||||
const auto out = field_utils::makeVector(yOut,
|
||||
field_utils::Value3D::Position);
|
||||
|
||||
missDist = G4LineSection::Distline(mid, in, out);
|
||||
|
||||
dyerr = field_utils::absoluteError(yOut, yError, hstep);
|
||||
|
||||
// copy non-integrated variables to output array
|
||||
//
|
||||
std::memcpy(yOut + nvar, yIn + nvar,
|
||||
sizeof(G4double) * (G4FieldTrack::ncompSVEC - nvar));
|
||||
|
||||
// set new state
|
||||
//
|
||||
track.LoadFromArray(yOut, G4FieldTrack::ncompSVEC);
|
||||
track.SetCurveLength(curveLength + hstep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
void G4BorisDriver::
|
||||
GetDerivatives( const G4FieldTrack& yTrack, G4double dydx[]) const
|
||||
{
|
||||
G4double EBfieldValue[6];
|
||||
GetDerivatives(yTrack, dydx, EBfieldValue);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
void G4BorisDriver::
|
||||
GetDerivatives( const G4FieldTrack& yTrack, G4double dydx[],
|
||||
G4double EBfieldValue[]) const
|
||||
{
|
||||
// G4Exception("G4BorisDriver::GetDerivatives()",
|
||||
// "GeomField0003", FatalException, "This method is not implemented.");
|
||||
G4double ytemp[G4FieldTrack::ncompSVEC];
|
||||
yTrack.DumpToArray(ytemp);
|
||||
GetEquationOfMotion()->EvaluateRhsReturnB(ytemp, dydx, EBfieldValue);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
G4double G4BorisDriver::ShrinkStepSize2(G4double h, G4double error2) const
|
||||
{
|
||||
if (error2 > fErrorConstraintShrink * fErrorConstraintShrink)
|
||||
{
|
||||
return fMaxSteppingDecrease * h;
|
||||
}
|
||||
return fSafetyFactor * h * std::pow(error2, 0.5 * fPowerShrink);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
G4double G4BorisDriver::GrowStepSize2(G4double h, G4double error2) const
|
||||
// Given the square of the relative error,
|
||||
{
|
||||
if (error2 < fErrorConstraintGrow * fErrorConstraintGrow)
|
||||
{
|
||||
return fMaxSteppingIncrease * h;
|
||||
}
|
||||
return fSafetyFactor * h * std::pow(error2, 0.5 * fPowerGrow);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
void G4BorisDriver::SetEquationOfMotion(G4EquationOfMotion* /*equation*/ )
|
||||
{
|
||||
G4Exception("G4BorisDriver::SetEquationOfMotion()", "GeomField0003", FatalException,
|
||||
"This method is not implemented. BorisDriver/Stepper should keep its equation");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
G4BorisDriver::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
os << "State of G4BorisDriver: " << std::endl;
|
||||
os << " Method is implemented, but gives no information. " << std::endl;
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4BorisScheme implementation
|
||||
//
|
||||
// Author: Divyansh Tiwari, Google Summer of Code 2022
|
||||
// Supervision: John Apostolakis,Renee Fatemi, Soon Yung Jun
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4BorisScheme.hh"
|
||||
#include "G4FieldUtils.hh"
|
||||
#include"G4SystemOfUnits.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
|
||||
#include "G4EquationOfMotion.hh"
|
||||
//#include "G4EqMagElectricField.hh"
|
||||
|
||||
using namespace field_utils;
|
||||
|
||||
G4BorisScheme::G4BorisScheme( G4EquationOfMotion* equation,
|
||||
G4int nvar )
|
||||
: fEquation(equation), fnvar(nvar)
|
||||
{
|
||||
if (nvar <= 0)
|
||||
{
|
||||
G4Exception("G4BorisScheme::G4BorisScheme()",
|
||||
"GeomField0002", FatalException,
|
||||
"Invalid number of variables; must be greater than zero!");
|
||||
}
|
||||
}
|
||||
|
||||
void G4BorisScheme::DoStep(const G4double restMass,const G4double charge, const G4double yIn[],
|
||||
G4double yOut[], G4double hstep) const
|
||||
{
|
||||
G4double yOut1Temp[G4FieldTrack::ncompSVEC];
|
||||
G4double yOut2Temp[G4FieldTrack::ncompSVEC];
|
||||
|
||||
// Used the scheme described in the following paper:https://www.research-collection.ethz.ch/bitstream/handle/20.500.11850/153167/eth-5175-01.pdf?sequence=1
|
||||
UpdatePosition(restMass, charge, yIn, yOut1Temp, hstep/2);
|
||||
UpdateVelocity(restMass, charge, yOut1Temp, yOut2Temp, hstep);
|
||||
UpdatePosition(restMass, charge, yOut2Temp, yOut, hstep/2);
|
||||
}
|
||||
|
||||
void G4BorisScheme::UpdatePosition(const G4double restMass, const G4double /*charge*/, const G4double yIn[],
|
||||
G4double yOut[], G4double hstep) const
|
||||
{
|
||||
// Particle information
|
||||
copy(yOut, yIn);
|
||||
|
||||
// Obtaining velocity
|
||||
G4ThreeVector momentum_vec =G4ThreeVector(yIn[3],yIn[4],yIn[5]);
|
||||
G4double momentum_mag = momentum_vec.mag();
|
||||
G4ThreeVector momentum_dir =(1.0/momentum_mag)*momentum_vec;
|
||||
|
||||
G4double velocity_mag = momentum_mag*(c_l)/(std::sqrt(sqr(momentum_mag) +sqr(restMass)));
|
||||
G4ThreeVector velocity = momentum_dir*velocity_mag;
|
||||
|
||||
//Obtaining the time step from the length step
|
||||
|
||||
hstep /= velocity_mag*CLHEP::m;
|
||||
|
||||
// Updating the Position
|
||||
for(G4int i = 0; i <3; i++ )
|
||||
{
|
||||
G4double pos = yIn[i]/CLHEP::m;
|
||||
pos += hstep*velocity[i];
|
||||
yOut[i] = pos*CLHEP::m;
|
||||
}
|
||||
}
|
||||
|
||||
void G4BorisScheme::UpdateVelocity(const G4double restMass, const G4double charge, const G4double yIn[],
|
||||
G4double yOut[], G4double hstep) const
|
||||
{
|
||||
//Particle information
|
||||
G4ThreeVector momentum_vec =G4ThreeVector(yIn[3],yIn[4],yIn[5]);
|
||||
G4double momentum_mag = momentum_vec.mag();
|
||||
G4ThreeVector momentum_dir =(1.0/momentum_mag)*momentum_vec;
|
||||
|
||||
G4double gamma = std::sqrt(sqr(momentum_mag) + sqr(restMass))/restMass;
|
||||
|
||||
G4double mass = (restMass/c_squared)/CLHEP::kg;
|
||||
|
||||
//Obtaining velocity
|
||||
|
||||
G4double velocity_mag = momentum_mag*(c_l)/(std::sqrt(sqr(momentum_mag) +sqr(restMass)));
|
||||
G4ThreeVector velocity = momentum_dir*velocity_mag;
|
||||
|
||||
////Obtaining the time step from the length step
|
||||
|
||||
hstep /= velocity_mag*CLHEP::m;
|
||||
|
||||
// Obtaining the field values
|
||||
G4double dydx[G4FieldTrack::ncompSVEC];
|
||||
G4double fieldValue[6] ={0,0,0,0,0,0};
|
||||
fEquation->EvaluateRhsReturnB(yIn, dydx, fieldValue);
|
||||
|
||||
//Initializing Vectors
|
||||
G4ThreeVector B;
|
||||
G4ThreeVector E;
|
||||
copy(yOut, yIn);
|
||||
for( G4int i = 0; i < 3; i++)
|
||||
{
|
||||
E[i] = fieldValue[i+3]/CLHEP::volt*CLHEP::meter;// FIXME - Check Units
|
||||
B[i] = fieldValue[i]/CLHEP::tesla;
|
||||
}
|
||||
|
||||
//Boris Algorithm
|
||||
G4double qd = hstep*(charge/(2*mass*gamma));
|
||||
G4ThreeVector h = qd*B;
|
||||
G4ThreeVector u = velocity + qd*E;
|
||||
G4double h_l = h[0]*h[0] + h[1]*h[1] + h[2]*h[2];
|
||||
G4ThreeVector s_1 = (2*h)/(1 + h_l);
|
||||
G4ThreeVector ud = u + (u + u.cross(h)).cross(s_1);
|
||||
G4ThreeVector v_fi = ud +qd*E;
|
||||
G4double v_mag = std::sqrt(v_fi.mag2());
|
||||
G4ThreeVector v_dir = v_fi/v_mag;
|
||||
G4double momen_mag = (restMass*v_mag)/(std::sqrt(c_l*c_l - v_mag*v_mag));
|
||||
G4ThreeVector momen = momen_mag*v_dir;
|
||||
|
||||
// Storing the updated momentum
|
||||
for(int i = 3; i < 6; i++)
|
||||
{
|
||||
yOut[i] = momen[i-3];
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
void G4BorisScheme::copy(G4double dst[], const G4double src[]) const
|
||||
{
|
||||
std::memcpy(dst, src, sizeof(G4double) * fnvar);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// - Methods using the Boris Scheme Stepping to estimate integration error
|
||||
// ----------------------------------------------------------------------------------
|
||||
void G4BorisScheme::
|
||||
StepWithErrorEstimate(const G4double yIn[], G4double restMass, G4double charge, G4double hstep,
|
||||
G4double yOut[], G4double yErr[]) const
|
||||
{
|
||||
// Use two half-steps (comparing to a full step) to obtain output and error estimate
|
||||
G4double yMid[G4FieldTrack::ncompSVEC];
|
||||
StepWithMidAndErrorEstimate(yIn, restMass, charge, hstep, yMid, yOut, yErr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
void G4BorisScheme::
|
||||
StepWithMidAndErrorEstimate(const G4double yIn[], G4double restMass, G4double charge, G4double hstep,
|
||||
G4double yMid[], G4double yOut[], G4double yErr[]
|
||||
) const
|
||||
{
|
||||
G4double halfStep= 0.5*hstep;
|
||||
G4double yOutAlt[G4FieldTrack::ncompSVEC];
|
||||
|
||||
// In a single step
|
||||
DoStep(restMass, charge, yIn, yOutAlt, hstep );
|
||||
|
||||
// Same, and also return mid-point evaluation
|
||||
DoStep(restMass, charge, yIn, yMid, halfStep );
|
||||
DoStep(restMass, charge, yMid, yOut, halfStep );
|
||||
|
||||
for( G4int i= 0; i<fnvar; i++ )
|
||||
{
|
||||
yErr[i] = yOutAlt[i] - yOut[i];
|
||||
}
|
||||
}
|
||||
@@ -236,12 +236,12 @@ void G4BulirschStoer::reset()
|
||||
m_last_step_rejected = false;
|
||||
}
|
||||
|
||||
void G4BulirschStoer::extrapolate(size_t k , G4double xest[])
|
||||
void G4BulirschStoer::extrapolate(std::size_t k , G4double xest[])
|
||||
{
|
||||
/* polynomial extrapolation, see http://www.nr.com/webnotes/nr3web21.pdf
|
||||
* uses the obtained intermediate results to extrapolate to dt->0 */
|
||||
|
||||
for(G4int j = k - 1 ; j > 0; --j)
|
||||
for(std::size_t j = k - 1 ; j > 0; --j)
|
||||
{
|
||||
for (G4int i = 0; i < fnvar; ++i)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ void G4BulirschStoer::extrapolate(size_t k , G4double xest[])
|
||||
}
|
||||
|
||||
G4double
|
||||
G4BulirschStoer::calc_h_opt(G4double h , G4double error , size_t k) const
|
||||
G4BulirschStoer::calc_h_opt(G4double h , G4double error , std::size_t k) const
|
||||
{
|
||||
/* calculates the optimal step size for a given error and stage number */
|
||||
|
||||
@@ -279,7 +279,7 @@ G4BulirschStoer::calc_h_opt(G4double h , G4double error , size_t k) const
|
||||
}
|
||||
|
||||
//why is not used!!??
|
||||
G4bool G4BulirschStoer::set_k_opt(size_t k, G4double& dt)
|
||||
G4bool G4BulirschStoer::set_k_opt(std::size_t k, G4double& dt)
|
||||
{
|
||||
/* calculates the optimal stage number */
|
||||
|
||||
@@ -290,19 +290,19 @@ G4bool G4BulirschStoer::set_k_opt(size_t k, G4double& dt)
|
||||
}
|
||||
if( (work[k-1] < KFAC1 * work[k]) || (k == m_k_max) ) // order decrease
|
||||
{
|
||||
m_current_k_opt = k - 1;
|
||||
m_current_k_opt = (G4int)k - 1;
|
||||
dt = h_opt[ m_current_k_opt ];
|
||||
return true;
|
||||
}
|
||||
else if( (work[k] < KFAC2 * work[k-1])
|
||||
|| m_last_step_rejected || (k == m_k_max-1) )
|
||||
{ // same order - also do this if last step got rejected
|
||||
m_current_k_opt = k;
|
||||
m_current_k_opt = (G4int)k;
|
||||
dt = h_opt[m_current_k_opt];
|
||||
return true;
|
||||
}
|
||||
else { // order increase - only if last step was not rejected
|
||||
m_current_k_opt = k + 1;
|
||||
m_current_k_opt = (G4int)k + 1;
|
||||
dt = h_opt[m_current_k_opt - 1] * m_cost[m_current_k_opt]
|
||||
/ m_cost[m_current_k_opt - 1];
|
||||
return true;
|
||||
|
||||
@@ -62,9 +62,9 @@ void G4DriverReporter::PrintStatus( const G4double* StartArr,
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
const G4int noPrecision = 8;
|
||||
const int prec7= noPrecision+2;
|
||||
const int prec8= noPrecision+3;
|
||||
const int prec9= noPrecision+4;
|
||||
const G4int prec7= noPrecision+2;
|
||||
const G4int prec8= noPrecision+3;
|
||||
const G4int prec9= noPrecision+4;
|
||||
|
||||
void G4DriverReporter::PrintStatus(const G4FieldTrack& StartFT,
|
||||
const G4FieldTrack& CurrentFT,
|
||||
@@ -72,7 +72,7 @@ void G4DriverReporter::PrintStatus(const G4FieldTrack& StartFT,
|
||||
unsigned int subStepNo)
|
||||
{
|
||||
G4int verboseLevel= 2; // fVerboseLevel;
|
||||
G4int oldPrec= G4cout.precision(noPrecision);
|
||||
G4long oldPrec= G4cout.precision(noPrecision);
|
||||
// G4cout.setf(ios_base::fixed,ios_base::floatfield);
|
||||
|
||||
const G4ThreeVector StartPosition= StartFT.GetPosition();
|
||||
@@ -143,7 +143,7 @@ void G4DriverReporter::PrintStat_Aux(const G4FieldTrack& aFieldTrack,
|
||||
const G4ThreeVector Position = aFieldTrack.GetPosition();
|
||||
const G4ThreeVector UnitVelocity = aFieldTrack.GetMomentumDir();
|
||||
|
||||
G4int oldprec= G4cout.precision(noPrecision);
|
||||
G4long oldprec= G4cout.precision(noPrecision);
|
||||
|
||||
if( subStepNo >= 0)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,14 @@
|
||||
|
||||
G4double G4FieldManager::fDefault_Delta_One_Step_Value= 0.01 * millimeter;
|
||||
G4double G4FieldManager::fDefault_Delta_Intersection_Val= 0.001 * millimeter;
|
||||
G4bool G4FieldManager::fVerboseConstruction= false;
|
||||
|
||||
G4double G4FieldManager::fMaxAcceptedEpsilon= 0.01; // Legacy value. Future value = 0.001
|
||||
// Requesting a large epsilon (max) value provides poor accuracy for
|
||||
// every integration segment.
|
||||
// Problems occur because some methods (including DormandPrince(7)45 the estimation of local
|
||||
// error appears to be a substantial underestimate at large epsilon values ( > 0.001 ).
|
||||
// So the value for fMaxAcceptedEpsilon is recommended to be 0.001 or below.
|
||||
|
||||
G4FieldManager::G4FieldManager(G4Field* detectorField,
|
||||
G4ChordFinder* pChordFinder,
|
||||
@@ -57,6 +65,9 @@ G4FieldManager::G4FieldManager(G4Field* detectorField,
|
||||
fFieldChangesEnergy = fieldChangesEnergy;
|
||||
}
|
||||
|
||||
if( fVerboseConstruction)
|
||||
G4cout << "G4FieldManager/ctor#1 fEpsilon Min/Max: eps_min = " << fEpsilonMin << " eps_max=" << fEpsilonMax << G4endl;
|
||||
|
||||
// Add to store
|
||||
//
|
||||
G4FieldManagerStore::Register(this);
|
||||
@@ -71,6 +82,8 @@ G4FieldManager::G4FieldManager(G4MagneticField* detectorField)
|
||||
{
|
||||
fChordFinder = new G4ChordFinder( detectorField );
|
||||
|
||||
if( fVerboseConstruction )
|
||||
G4cout << "G4FieldManager/ctor#2 fEpsilon Min/Max: eps_min = " << fEpsilonMin << " eps_max=" << fEpsilonMax << G4endl;
|
||||
// Add to store
|
||||
//
|
||||
G4FieldManagerStore::Register(this);
|
||||
@@ -128,6 +141,8 @@ G4FieldManager* G4FieldManager::Clone() const
|
||||
delete aCF;
|
||||
throw;
|
||||
}
|
||||
|
||||
G4cout << "G4FieldManager/clone fEpsilon Min/Max: eps_min = " << fEpsilonMin << " eps_max=" << fEpsilonMax << G4endl;
|
||||
return aFM;
|
||||
}
|
||||
|
||||
@@ -234,3 +249,195 @@ G4bool G4FieldManager::SetDetectorField(G4Field* pDetectorField,
|
||||
}
|
||||
return ableToSet;
|
||||
}
|
||||
|
||||
G4bool G4FieldManager::SetMaximumEpsilonStep( G4double newEpsMax )
|
||||
{
|
||||
G4bool succeeded= false;
|
||||
if( (newEpsMax > 0.0) && ( newEpsMax <= fMaxAcceptedEpsilon)
|
||||
&& (fMinAcceptedEpsilon <= newEpsMax ) ) // (std::fabs(1.0+newEpsMax)>1.0) )
|
||||
{
|
||||
if(newEpsMax >= fEpsilonMin){
|
||||
fEpsilonMax = newEpsMax;
|
||||
succeeded = true;
|
||||
// if(verbose)
|
||||
G4cout << "G4FieldManager/SetEpsMax : eps_max = " << std::setw(10) << fEpsilonMax
|
||||
<< " ( Note: unchanged eps_min=" << std::setw(10) << fEpsilonMin << " )" << G4endl;
|
||||
} else {
|
||||
G4ExceptionDescription erm;
|
||||
erm << " Call to set eps_max = " << newEpsMax << " . The problem is that"
|
||||
<< " its value must be at larger or equal to eps_min= " << fEpsilonMin << G4endl;
|
||||
erm << " Modifying both to the same value " << newEpsMax << " to ensure consistency."
|
||||
<< G4endl
|
||||
<< " To avoid this warning, please set eps_min first, and ensure that "
|
||||
<< " 0 < eps_min <= eps_max <= " << fMaxAcceptedEpsilon << G4endl;
|
||||
|
||||
fEpsilonMax = newEpsMax;
|
||||
fEpsilonMin = newEpsMax;
|
||||
G4String methodName = G4String("G4FieldManager::")+ G4String(__func__);
|
||||
G4Exception(methodName.c_str(), "Geometry003", JustWarning, erm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4ExceptionDescription erm;
|
||||
G4String paramName("eps_max");
|
||||
ReportBadEpsilonValue(erm, newEpsMax, paramName );
|
||||
G4String methodName = G4String("G4FieldManager::")+ G4String(__func__);
|
||||
G4Exception(methodName.c_str(), "Geometry001", FatalException, erm);
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
G4bool G4FieldManager::SetMinimumEpsilonStep( G4double newEpsMin )
|
||||
{
|
||||
G4bool succeeded= false;
|
||||
|
||||
if( fMinAcceptedEpsilon <= newEpsMin && newEpsMin <= fMaxAcceptedEpsilon )
|
||||
{
|
||||
fEpsilonMin = newEpsMin;
|
||||
//*********
|
||||
succeeded= true;
|
||||
|
||||
G4cout << "G4FieldManager/SetEpsMin : eps_min = "
|
||||
<< std::setw(10) << fEpsilonMin << G4endl;
|
||||
if( fEpsilonMax < fEpsilonMin ){
|
||||
// Ensure consistency
|
||||
G4ExceptionDescription erm;
|
||||
erm << "Setting eps_min = " << newEpsMin
|
||||
<< " For consistency set eps_max= " << fEpsilonMin
|
||||
<< " ( Old value = " << fEpsilonMax << " )" << G4endl;
|
||||
fEpsilonMax = fEpsilonMin;
|
||||
G4String methodName = G4String("G4FieldManager::")+ G4String(__func__);
|
||||
G4Exception(methodName.c_str(), "Geometry003", JustWarning, erm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4ExceptionDescription erm;
|
||||
G4String paramName("eps_min");
|
||||
ReportBadEpsilonValue(erm, newEpsMin, paramName );
|
||||
G4String methodName = G4String("G4FieldManager::")+ G4String(__func__);
|
||||
G4Exception(methodName.c_str(), "Geometry001", FatalException, erm);
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
G4double G4FieldManager::GetMaxAcceptedEpsilon()
|
||||
{
|
||||
return fMaxAcceptedEpsilon;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
G4bool G4FieldManager::SetMaxAcceptedEpsilon(G4double maxAcceptValue, G4bool softFailure)
|
||||
// Set value -- within limits
|
||||
{
|
||||
G4bool success= false;
|
||||
// Limit for warning and absolute limit chosen from experience in and
|
||||
// investigation of integration with G4DormandPrince745 in HEP-type setups.
|
||||
if( maxAcceptValue <= fMaxWarningEpsilon )
|
||||
{
|
||||
fMaxAcceptedEpsilon= maxAcceptValue;
|
||||
success= true;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4ExceptionDescription erm;
|
||||
G4ExceptionSeverity severity;
|
||||
|
||||
G4cout << "G4FieldManager::" << __func__
|
||||
<< " Parameters: fMaxAcceptedEpsilon = " << fMaxAcceptedEpsilon
|
||||
<< " fMaxFinalEpsilon = " << fMaxFinalEpsilon << G4endl;
|
||||
|
||||
if( maxAcceptValue <= fMaxFinalEpsilon )
|
||||
{
|
||||
success= true;
|
||||
fMaxAcceptedEpsilon = maxAcceptValue;
|
||||
// Integration is poor, and robustness will likely suffer
|
||||
erm << "Proposed value for maximum-accepted-epsilon = " << maxAcceptValue
|
||||
<< " is larger than the recommended = " << fMaxWarningEpsilon
|
||||
<< G4endl
|
||||
<< "This may impact the robustness of integration of tracks in field."
|
||||
<< G4endl
|
||||
<< "The request was accepted and the value = " << fMaxAcceptedEpsilon
|
||||
<< " , but future releases are expected " << G4endl
|
||||
<< " to tighten the limit of acceptable values to "
|
||||
<< fMaxWarningEpsilon << G4endl << G4endl
|
||||
<< "Suggestion: If you need better performance investigate using "
|
||||
<< "alternative, low-order RK integration methods or " << G4endl
|
||||
<< " helix-based methods (for pure B-fields) for low(er) energy tracks, "
|
||||
<< " especially electrons if you need better performance." << G4endl;
|
||||
severity= JustWarning;
|
||||
}
|
||||
else
|
||||
{
|
||||
fMaxAcceptedEpsilon= fMaxFinalEpsilon;
|
||||
erm << " Proposed value for maximum accepted epsilon " << maxAcceptValue
|
||||
<< " is larger than the top of the range = " << fMaxFinalEpsilon
|
||||
<< G4endl;
|
||||
if( softFailure )
|
||||
erm << " Using the latter value instead." << G4endl;
|
||||
erm << G4endl;
|
||||
erm << " Please adjust to request maxAccepted <= " << fMaxFinalEpsilon
|
||||
<< G4endl << G4endl;
|
||||
if( softFailure == false )
|
||||
erm << " NOTE: you can accept the ceiling value and turn this into a "
|
||||
<< " warning by using a 2nd argument " << G4endl
|
||||
<< " in your call to SetMaxAcceptedEpsilon: softFailure = true ";
|
||||
severity = softFailure ? JustWarning : FatalException;
|
||||
// if( softFailure ) severity= JustWarning;
|
||||
// else severity= FatalException;
|
||||
success = false;
|
||||
}
|
||||
G4String methodName = G4String("G4FieldManager::")+ G4String(__func__);
|
||||
G4Exception(methodName.c_str(), "Geometry003", severity, erm);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void G4FieldManager::
|
||||
ReportBadEpsilonValue(G4ExceptionDescription& erm, G4double value, G4String& name) const
|
||||
{
|
||||
erm << "Incorrect proposed value of " << name << " = " << value << G4endl
|
||||
<< " Its value is outside the permitted range from "
|
||||
<< fMinAcceptedEpsilon << " to " << fMaxAcceptedEpsilon << G4endl
|
||||
<< " Clarification: " << G4endl;
|
||||
G4long oldPrec = erm.precision();
|
||||
if(value < fMinAcceptedEpsilon )
|
||||
{
|
||||
erm << " a) The value must be positive and enough larger than the accuracy limit"
|
||||
<< " of the (G4)double type - ("
|
||||
<< (value < fMinAcceptedEpsilon ? "FAILED" : "OK" ) << ")" << G4endl
|
||||
<< " i.e. std::numeric_limits<G4double>::epsilon()= "
|
||||
<< std::numeric_limits<G4double>::epsilon()
|
||||
<< " to ensure that integration " << G4endl
|
||||
<< " could potentially achieve this acccuracy." << G4endl
|
||||
<< " Minimum accepted eps_min/max value = " << fMinAcceptedEpsilon << G4endl;
|
||||
}
|
||||
else if( value > fMaxAcceptedEpsilon)
|
||||
{
|
||||
erm << " b) It must be smaller than (or equal) " << std::setw(8)
|
||||
<< std::setprecision(4) << fMaxAcceptedEpsilon
|
||||
<< " to ensure robustness of integration - ("
|
||||
<< (( value < fMaxAcceptedEpsilon) ? "OK" : "FAILED" ) << ")" << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4bool badRoundoff = (std::fabs(1.0+value) == 1.0);
|
||||
erm << " Unknown ERROR case -- extra check: " << G4endl;
|
||||
erm << " c) as a floating point number (of type G4double) the sum (1+" << name
|
||||
<< " ) must be > 1 , ("
|
||||
<< (badRoundoff ? "FAILED" : "OK" ) << ")" << G4endl
|
||||
<< " Now 1+eps_min = " << std::setw(20)
|
||||
<< std::setprecision(17) << (1+value) << G4endl
|
||||
<< " and (1.0+" << name << ") - 1.0 = " << std::setw(20)
|
||||
<< std::setprecision(9) << (1.0+value)-1.0;
|
||||
}
|
||||
erm.precision(oldPrec);
|
||||
}
|
||||
|
||||
@@ -71,26 +71,13 @@ void G4FieldManagerStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
size_t i=0;
|
||||
G4FieldManagerStore* store = GetInstance();
|
||||
|
||||
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
|
||||
{
|
||||
if (*pos) { delete *pos; }
|
||||
i++;
|
||||
}
|
||||
|
||||
#ifdef G4GEOMETRY_DEBUG
|
||||
if (store->size() < i-1)
|
||||
{
|
||||
G4cout << "No field managers deleted. Already deleted by user ?" << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << i-1 << " field managers deleted !" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
locked = false;
|
||||
store->clear();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ std::ostream& operator<<( std::ostream& os, const G4FieldTrack& SixVec)
|
||||
const G4int precLen= 12; // For Length along track
|
||||
const G4int precSpin= 9; // For polarisation
|
||||
const G4int precTime= 6; // For time of flight
|
||||
const G4int oldpr= os.precision(precPos);
|
||||
const G4long oldpr= os.precision(precPos);
|
||||
os << " ( ";
|
||||
os << " X= " << SixV[0] << " " << SixV[1] << " "
|
||||
<< SixV[2] << " "; // Position
|
||||
|
||||
@@ -95,7 +95,7 @@ G4double relativeError(const G4double y[],
|
||||
return std::sqrt(relativeError2(y, yError, h, errorTolerance));
|
||||
}
|
||||
|
||||
void copy(G4double dst[], const G4double src[], size_t size)
|
||||
void copy(G4double dst[], const G4double src[], std::size_t size)
|
||||
{
|
||||
std::memcpy(dst, src, sizeof(G4double) * size);
|
||||
}
|
||||
|
||||
@@ -104,10 +104,11 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
// interval. RightHandSide is the right-hand side of ODE system.
|
||||
// The source is similar to odeint routine from NRC p.721-722 .
|
||||
|
||||
G4int nstp, i, no_warnings = 0;
|
||||
G4int nstp, i;
|
||||
G4double x, hnext, hdid, h;
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4int no_warnings = 0;
|
||||
static G4int dbg = 1;
|
||||
static G4int nStpPr = 50; // For debug printing of long integrations
|
||||
G4double ySubStepStart[G4FieldTrack::ncompSVEC];
|
||||
@@ -117,12 +118,10 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
|
||||
G4double ystart[G4FieldTrack::ncompSVEC], yEnd[G4FieldTrack::ncompSVEC];
|
||||
G4double x1, x2;
|
||||
G4bool succeeded = true, lastStepSucceeded;
|
||||
G4bool succeeded = true;
|
||||
|
||||
G4double startCurveLength;
|
||||
|
||||
G4int noFullIntegr = 0, noSmallIntegr = 0;
|
||||
static G4ThreadLocal G4int noGoodSteps = 0; // Bad = chord > curve-len
|
||||
const G4int nvar = fNoVars;
|
||||
|
||||
G4FieldTrack yStartFT(y_current);
|
||||
@@ -194,7 +193,6 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
{
|
||||
OneGoodStep(y,dydx,x,h,eps,hdid,hnext) ;
|
||||
//--------------------------------------
|
||||
lastStepSucceeded = (hdid == h);
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if (dbg>2)
|
||||
{
|
||||
@@ -247,14 +245,8 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
|
||||
// Compute suggested new step
|
||||
hnext = ComputeNewStepSize( dyerr/eps, h);
|
||||
|
||||
// .. hnext= ComputeNewStepSize_WithinLimits( dyerr/eps, h);
|
||||
lastStepSucceeded = (dyerr<= eps);
|
||||
}
|
||||
|
||||
if (lastStepSucceeded) { ++noFullIntegr; }
|
||||
else { ++noSmallIntegr; }
|
||||
|
||||
G4ThreeVector EndPos( y[0], y[1], y[2] );
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
@@ -285,19 +277,13 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
{
|
||||
WarnEndPointTooFar ( endPointDist, hdid, eps, dbg );
|
||||
G4cerr << " Total steps: bad " << fNoBadSteps
|
||||
<< " good " << noGoodSteps << " current h= " << hdid
|
||||
<< G4endl;
|
||||
<< " current h= " << hdid << G4endl;
|
||||
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
|
||||
}
|
||||
#endif
|
||||
++no_warnings;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++noGoodSteps;
|
||||
}
|
||||
// #endif
|
||||
|
||||
// Avoid numerous small last steps
|
||||
if( (h < eps * hstep) || (h < fSmallestFraction * startCurveLength) )
|
||||
@@ -372,9 +358,9 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
|
||||
if(nstp > fMaxNoSteps)
|
||||
{
|
||||
++no_warnings;
|
||||
succeeded = false;
|
||||
#ifdef G4DEBUG_FIELD
|
||||
++no_warnings;
|
||||
if (dbg)
|
||||
{
|
||||
WarnTooManyStep( x1, x2, x ); // Issue WARNING
|
||||
@@ -517,7 +503,6 @@ G4MagInt_Driver::OneGoodStep( G4double y[], // InOut
|
||||
G4double errvel_sq = 0.0; // square of momentum vector difference
|
||||
G4double errspin_sq = 0.0; // square of spin vector difference
|
||||
|
||||
static G4ThreadLocal G4int tot_no_trials=0;
|
||||
const G4int max_trials=100;
|
||||
|
||||
G4ThreeVector Spin(y[9],y[10],y[11]);
|
||||
@@ -526,7 +511,6 @@ G4MagInt_Driver::OneGoodStep( G4double y[], // InOut
|
||||
|
||||
for (G4int iter=0; iter<max_trials; ++iter)
|
||||
{
|
||||
++tot_no_trials;
|
||||
pIntStepper-> Stepper(y,dydx,h,ytemp,yerr);
|
||||
// *******
|
||||
G4double eps_pos = eps_rel_max * std::max(h, fMinimumStep);
|
||||
@@ -639,9 +623,6 @@ G4bool G4MagInt_Driver::QuickAdvance(G4FieldTrack& y_posvel, // INOUT
|
||||
G4double s_start;
|
||||
G4double dyerr_mom_sq, vel_mag_sq, inv_vel_mag_sq;
|
||||
|
||||
static G4ThreadLocal G4int no_call = 0;
|
||||
++no_call;
|
||||
|
||||
// Move data into array
|
||||
y_posvel.DumpToArray( yarrin ); // yarrin <== y_posvel
|
||||
s_start = y_posvel.GetCurveLength();
|
||||
@@ -832,7 +813,7 @@ void G4MagInt_Driver::PrintStatus(const G4FieldTrack& StartFT,
|
||||
{
|
||||
G4int verboseLevel= fVerboseLevel;
|
||||
const G4int noPrecision = 5;
|
||||
G4int oldPrec= G4cout.precision(noPrecision);
|
||||
G4long oldPrec= G4cout.precision(noPrecision);
|
||||
// G4cout.setf(ios_base::fixed,ios_base::floatfield);
|
||||
|
||||
const G4ThreeVector StartPosition= StartFT.GetPosition();
|
||||
@@ -914,7 +895,7 @@ void G4MagInt_Driver::PrintStat_Aux(const G4FieldTrack& aFieldTrack,
|
||||
<< std::setw( 8) << UnitVelocity.x() << " "
|
||||
<< std::setw( 8) << UnitVelocity.y() << " "
|
||||
<< std::setw( 8) << UnitVelocity.z() << " ";
|
||||
G4int oldprec= G4cout.precision(3);
|
||||
G4long oldprec= G4cout.precision(3);
|
||||
G4cout << std::setw( 8) << UnitVelocity.mag2()-1.0 << " ";
|
||||
G4cout.precision(6);
|
||||
G4cout << std::setw(10) << dotVeloc_StartCurr << " ";
|
||||
@@ -956,7 +937,7 @@ void G4MagInt_Driver::PrintStat_Aux(const G4FieldTrack& aFieldTrack,
|
||||
void G4MagInt_Driver::PrintStatisticsReport()
|
||||
{
|
||||
G4int noPrecBig = 6;
|
||||
G4int oldPrec = G4cout.precision(noPrecBig);
|
||||
G4long oldPrec = G4cout.precision(noPrecBig);
|
||||
|
||||
G4cout << "G4MagInt_Driver Statistics of steps undertaken. " << G4endl;
|
||||
G4cout << "G4MagInt_Driver: Number of Steps: "
|
||||
|
||||
@@ -103,10 +103,11 @@ G4OldMagIntDriver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
// interval. RightHandSide is the right-hand side of ODE system.
|
||||
// The source is similar to odeint routine from NRC p.721-722 .
|
||||
|
||||
G4int nstp, i, no_warnings = 0;
|
||||
G4int nstp, i;
|
||||
G4double x, hnext, hdid, h;
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4int no_warnings = 0;
|
||||
static G4int dbg = 1;
|
||||
G4double ySubStepStart[G4FieldTrack::ncompSVEC];
|
||||
G4FieldTrack yFldTrkStart(y_current);
|
||||
@@ -115,12 +116,10 @@ G4OldMagIntDriver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
|
||||
G4double ystart[G4FieldTrack::ncompSVEC], yEnd[G4FieldTrack::ncompSVEC];
|
||||
G4double x1, x2;
|
||||
G4bool succeeded = true, lastStepSucceeded;
|
||||
G4bool succeeded = true;
|
||||
|
||||
G4double startCurveLength;
|
||||
|
||||
G4int noFullIntegr = 0, noSmallIntegr = 0;
|
||||
static G4ThreadLocal G4int noGoodSteps = 0; // Bad = chord > curve-len
|
||||
const G4int nvar = fNoVars;
|
||||
|
||||
G4FieldTrack yStartFT(y_current);
|
||||
@@ -200,7 +199,7 @@ G4OldMagIntDriver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
{
|
||||
OneGoodStep(y,dydx,x,h,eps,hdid,hnext) ;
|
||||
//--------------------------------------
|
||||
lastStepSucceeded = (hdid == h);
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if (dbg) // (dbg>2)
|
||||
{
|
||||
@@ -256,12 +255,8 @@ G4OldMagIntDriver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
hnext = ComputeNewStepSize( dyerr/eps, h);
|
||||
|
||||
// .. hnext= ComputeNewStepSize_WithinLimits( dyerr/eps, h);
|
||||
lastStepSucceeded = (dyerr<= eps);
|
||||
}
|
||||
|
||||
if (lastStepSucceeded) { ++noFullIntegr; }
|
||||
else { ++noSmallIntegr; }
|
||||
|
||||
G4ThreeVector EndPos( y[0], y[1], y[2] );
|
||||
|
||||
#if (G4DEBUG_FIELD>1)
|
||||
@@ -293,19 +288,13 @@ G4OldMagIntDriver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
{
|
||||
WarnEndPointTooFar ( endPointDist, hdid, eps, dbg );
|
||||
G4cerr << " Total steps: bad " << fNoBadSteps
|
||||
<< " good " << noGoodSteps << " current h= " << hdid
|
||||
<< G4endl;
|
||||
<< " current h= " << hdid << G4endl;
|
||||
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
|
||||
}
|
||||
#endif
|
||||
++no_warnings;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++noGoodSteps;
|
||||
}
|
||||
// #endif
|
||||
|
||||
// Avoid numerous small last steps
|
||||
if( (h < eps * hstep) || (h < fSmallestFraction * startCurveLength) )
|
||||
@@ -380,9 +369,9 @@ G4OldMagIntDriver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
|
||||
if(nstp > fMaxNoSteps)
|
||||
{
|
||||
++no_warnings;
|
||||
succeeded = false;
|
||||
#ifdef G4DEBUG_FIELD
|
||||
++no_warnings;
|
||||
if (dbg)
|
||||
{
|
||||
WarnTooManyStep( x1, x2, x ); // Issue WARNING
|
||||
@@ -525,7 +514,6 @@ G4OldMagIntDriver::OneGoodStep( G4double y[], // InOut
|
||||
G4double errvel_sq = 0.0; // square of momentum vector difference
|
||||
G4double errspin_sq = 0.0; // square of spin vector difference
|
||||
|
||||
static G4ThreadLocal G4int tot_no_trials=0;
|
||||
const G4int max_trials=100;
|
||||
|
||||
G4ThreeVector Spin(y[9],y[10],y[11]);
|
||||
@@ -534,7 +522,6 @@ G4OldMagIntDriver::OneGoodStep( G4double y[], // InOut
|
||||
|
||||
for (G4int iter=0; iter<max_trials; ++iter)
|
||||
{
|
||||
++tot_no_trials;
|
||||
pIntStepper-> Stepper(y,dydx,h,ytemp,yerr);
|
||||
// *******
|
||||
G4double eps_pos = eps_rel_max * std::max(h, fMinimumStep);
|
||||
@@ -647,9 +634,6 @@ G4bool G4OldMagIntDriver::QuickAdvance(G4FieldTrack& y_posvel, // INOUT
|
||||
G4double s_start;
|
||||
G4double dyerr_mom_sq, vel_mag_sq, inv_vel_mag_sq;
|
||||
|
||||
static G4ThreadLocal G4int no_call = 0;
|
||||
++no_call;
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
G4FieldTrack startTrack( y_posvel ); // For debugging
|
||||
#endif
|
||||
@@ -713,7 +697,7 @@ G4bool G4OldMagIntDriver::QuickAdvance(G4FieldTrack& y_posvel, // INOUT
|
||||
#ifdef G4DEBUG_FIELD
|
||||
// For debugging
|
||||
G4cout // << "G4MagInt_Driver::"
|
||||
<< "QuickAdvance call # " << no_call << G4endl
|
||||
<< "QuickAdvance" << G4endl
|
||||
<< " Input: hstep= " << hstep << G4endl
|
||||
<< " track= " << startTrack << G4endl
|
||||
<< " Output: track= " << y_posvel << G4endl
|
||||
@@ -844,7 +828,7 @@ void G4OldMagIntDriver::PrintStatus(const G4FieldTrack& StartFT,
|
||||
{
|
||||
G4int verboseLevel= fVerboseLevel;
|
||||
const G4int noPrecision = 5;
|
||||
G4int oldPrec= G4cout.precision(noPrecision);
|
||||
G4long oldPrec= G4cout.precision(noPrecision);
|
||||
// G4cout.setf(ios_base::fixed,ios_base::floatfield);
|
||||
|
||||
const G4ThreeVector StartPosition= StartFT.GetPosition();
|
||||
@@ -926,7 +910,7 @@ void G4OldMagIntDriver::PrintStat_Aux(const G4FieldTrack& aFieldTrack,
|
||||
<< std::setw( 8) << UnitVelocity.x() << " "
|
||||
<< std::setw( 8) << UnitVelocity.y() << " "
|
||||
<< std::setw( 8) << UnitVelocity.z() << " ";
|
||||
G4int oldprec= G4cout.precision(3);
|
||||
G4long oldprec= G4cout.precision(3);
|
||||
G4cout << std::setw( 8) << UnitVelocity.mag2()-1.0 << " ";
|
||||
G4cout.precision(6);
|
||||
G4cout << std::setw(10) << dotVeloc_StartCurr << " ";
|
||||
@@ -968,7 +952,7 @@ void G4OldMagIntDriver::PrintStat_Aux(const G4FieldTrack& aFieldTrack,
|
||||
void G4OldMagIntDriver::PrintStatisticsReport()
|
||||
{
|
||||
G4int noPrecBig = 6;
|
||||
G4int oldPrec = G4cout.precision(noPrecBig);
|
||||
G4long oldPrec = G4cout.precision(noPrecBig);
|
||||
|
||||
G4cout << "G4OldMagIntDriver Statistics of steps undertaken. " << G4endl;
|
||||
G4cout << "G4OldMagIntDriver: Number of Steps: "
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
# Category geommng History
|
||||
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-16 Gabriele Cosmo (geommng-V11-00-09)
|
||||
- Fixed more compilation warnings for implicit type conversions on
|
||||
macOS/XCode 14.1 in G4SmartVoxelNode source.
|
||||
|
||||
## 2022-11-10 Gabriele Cosmo (geommng-V11-00-08)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-10-04 Gabriele Cosmo (geommng-V11-00-07)
|
||||
- Fixed compilation warnings on Intel/icx compiler for variables set but not
|
||||
used.
|
||||
|
||||
### 2022-08-16 Gabriele Cosmo (geommng-V11-00-06)
|
||||
- Added protection in G4GeometryManager for Open/CloseGeometry() to
|
||||
be executed only by master thread.
|
||||
Addressing problem report #2502.
|
||||
|
||||
## 2022-07-03 Ben Morgan (geommng-V11-00-05)
|
||||
- Add headers for directly used classes from global/HEPGeometry
|
||||
|
||||
## 2022-04-13 Ben Morgan (geommng-V11-00-04)
|
||||
- Add missing dependency on G4heprandom
|
||||
|
||||
@@ -73,7 +73,7 @@ class G4BlockingList
|
||||
// Enlarges blocking List if current size < nv, in units of stride.
|
||||
// Clears the new part of the List.
|
||||
|
||||
size_t Length() const;
|
||||
std::size_t Length() const;
|
||||
// Returns the current length of the List. Note a length of 16
|
||||
// means volumes of indices between 0 & 15 inclusive may be blocked.
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
inline size_t G4BlockingList::Length() const
|
||||
inline std::size_t G4BlockingList::Length() const
|
||||
{
|
||||
return fBlockingList.size();
|
||||
}
|
||||
@@ -59,10 +59,10 @@ inline void G4BlockingList::Reset()
|
||||
|
||||
inline void G4BlockingList::Enlarge(const G4int nv)
|
||||
{
|
||||
size_t len=fBlockingList.size();
|
||||
std::size_t len=fBlockingList.size();
|
||||
if ( G4int(len)<nv )
|
||||
{
|
||||
size_t newlen = (nv/fStride+1)*fStride;
|
||||
std::size_t newlen = (nv/fStride+1)*fStride;
|
||||
fBlockingList.resize(newlen);
|
||||
for (auto i=len; i<newlen; ++i)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
#include "globals.hh"
|
||||
#include "G4ErrorSurfaceTarget.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
#include "G4Plane3D.hh"
|
||||
#include "G4Point3D.hh"
|
||||
|
||||
class G4ErrorPlaneSurfaceTarget : public G4ErrorSurfaceTarget, G4Plane3D
|
||||
{
|
||||
|
||||
@@ -209,9 +209,9 @@ class G4LogicalVolume
|
||||
void SetName(const G4String& pName);
|
||||
// Returns and sets the name of the logical volume.
|
||||
|
||||
inline size_t GetNoDaughters() const;
|
||||
inline std::size_t GetNoDaughters() const;
|
||||
// Returns the number of daughters (0 to n).
|
||||
inline G4VPhysicalVolume* GetDaughter(const G4int i) const;
|
||||
inline G4VPhysicalVolume* GetDaughter(const std::size_t i) const;
|
||||
// Returns the ith daughter. Note numbering starts from 0,
|
||||
// and no bounds checking is performed.
|
||||
void AddDaughter(G4VPhysicalVolume* p);
|
||||
|
||||
@@ -69,7 +69,7 @@ G4FieldManager* G4LogicalVolume::GetMasterFieldManager() const
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
size_t G4LogicalVolume::GetNoDaughters() const
|
||||
std::size_t G4LogicalVolume::GetNoDaughters() const
|
||||
{
|
||||
return fDaughters.size();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ size_t G4LogicalVolume::GetNoDaughters() const
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const G4int i) const
|
||||
G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const std::size_t i) const
|
||||
{
|
||||
return fDaughters[i];
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@ class G4Region
|
||||
GetMaterialIterator() const;
|
||||
// Return iterators to lists of root logical volumes and materials.
|
||||
|
||||
inline size_t GetNumberOfMaterials() const;
|
||||
inline size_t GetNumberOfRootVolumes() const;
|
||||
inline std::size_t GetNumberOfMaterials() const;
|
||||
inline std::size_t GetNumberOfRootVolumes() const;
|
||||
// Return the number of elements in the lists of materials and
|
||||
// root logical volumes.
|
||||
|
||||
|
||||
@@ -100,10 +100,10 @@ class G4SmartVoxelHeader
|
||||
G4double GetMinExtent() const;
|
||||
// Return the minimum coordinate limit along the current axis.
|
||||
|
||||
size_t GetNoSlices() const;
|
||||
std::size_t GetNoSlices() const;
|
||||
// Return the no of slices along the current axis.
|
||||
|
||||
G4SmartVoxelProxy* GetSlice(G4int n) const;
|
||||
G4SmartVoxelProxy* GetSlice(std::size_t n) const;
|
||||
// Return ptr to the proxy for the nth slice (numbering from 0,
|
||||
// no bounds checking performed).
|
||||
|
||||
|
||||
@@ -76,13 +76,13 @@ G4double G4SmartVoxelHeader::GetMinExtent() const
|
||||
}
|
||||
|
||||
inline
|
||||
size_t G4SmartVoxelHeader::GetNoSlices() const
|
||||
std::size_t G4SmartVoxelHeader::GetNoSlices() const
|
||||
{
|
||||
return fslices.size();
|
||||
}
|
||||
|
||||
inline
|
||||
G4SmartVoxelProxy* G4SmartVoxelHeader::GetSlice(G4int n) const
|
||||
G4SmartVoxelProxy* G4SmartVoxelHeader::GetSlice(std::size_t n) const
|
||||
{
|
||||
return fslices[n];
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "globals.hh"
|
||||
#include "G4BoundingEnvelope.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
|
||||
const G4double kCarTolerance =
|
||||
G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
@@ -129,7 +130,7 @@ void G4BoundingEnvelope::CheckBoundingBox()
|
||||
//
|
||||
void G4BoundingEnvelope::CheckBoundingPolygons()
|
||||
{
|
||||
G4int nbases = fPolygons->size();
|
||||
std::size_t nbases = fPolygons->size();
|
||||
if (nbases < 2)
|
||||
{
|
||||
std::ostringstream message;
|
||||
@@ -140,7 +141,7 @@ void G4BoundingEnvelope::CheckBoundingPolygons()
|
||||
return;
|
||||
}
|
||||
|
||||
G4int nsize = std::max((*fPolygons)[0]->size(),(*fPolygons)[1]->size());
|
||||
std::size_t nsize = std::max((*fPolygons)[0]->size(),(*fPolygons)[1]->size());
|
||||
if (nsize < 3)
|
||||
{
|
||||
std::ostringstream message;
|
||||
@@ -154,9 +155,9 @@ void G4BoundingEnvelope::CheckBoundingPolygons()
|
||||
return;
|
||||
}
|
||||
|
||||
for (G4int k=0; k<nbases; ++k)
|
||||
for (std::size_t k=0; k<nbases; ++k)
|
||||
{
|
||||
G4int np = (*fPolygons)[k]->size();
|
||||
std::size_t np = (*fPolygons)[k]->size();
|
||||
if (np == nsize) continue;
|
||||
if (np == 1 && k==0) continue;
|
||||
if (np == 1 && k==nbases-1) continue;
|
||||
@@ -423,7 +424,7 @@ G4BoundingEnvelope::CalculateExtent(const EAxis pAxis,
|
||||
std::vector<G4Point3D> vertices;
|
||||
std::vector<std::pair<G4int, G4int>> bases;
|
||||
TransformVertices(pTransform3D, vertices, bases);
|
||||
G4int nbases = bases.size();
|
||||
std::size_t nbases = bases.size();
|
||||
|
||||
// Create adjusted G4VoxelLimits box. New limits are extended by
|
||||
// delta, kCarTolerance multiplied by max scale factor of
|
||||
@@ -447,7 +448,7 @@ G4BoundingEnvelope::CalculateExtent(const EAxis pAxis,
|
||||
G4Segment3D extent;
|
||||
extent.first = G4Point3D( kInfinity, kInfinity, kInfinity);
|
||||
extent.second = G4Point3D(-kInfinity,-kInfinity,-kInfinity);
|
||||
for (G4int k=0; k<nbases-1; ++k)
|
||||
for (std::size_t k=0; k<nbases-1; ++k)
|
||||
{
|
||||
baseA.resize(bases[k].second);
|
||||
for (G4int i = 0; i < bases[k].second; ++i)
|
||||
@@ -599,7 +600,7 @@ TransformVertices(const G4Transform3D& pTransform3D,
|
||||
G4int index = 0;
|
||||
for (auto i = ia; i != iaend; ++i)
|
||||
{
|
||||
G4int nv = (*i)->size();
|
||||
G4int nv = (G4int)(*i)->size();
|
||||
pBases.push_back(std::make_pair(index, nv));
|
||||
index += nv;
|
||||
}
|
||||
@@ -680,14 +681,14 @@ G4BoundingEnvelope::CreateListOfEdges(const G4Polygon3D& baseA,
|
||||
const G4Polygon3D& baseB,
|
||||
std::vector<G4Segment3D>& pEdges) const
|
||||
{
|
||||
G4int na = baseA.size();
|
||||
G4int nb = baseB.size();
|
||||
std::size_t na = baseA.size();
|
||||
std::size_t nb = baseB.size();
|
||||
pEdges.clear();
|
||||
if (na == nb)
|
||||
{
|
||||
pEdges.resize(3*na);
|
||||
G4int k = na - 1;
|
||||
for (G4int i=0; i<na; ++i)
|
||||
std::size_t k = na - 1;
|
||||
for (std::size_t i=0; i<na; ++i)
|
||||
{
|
||||
pEdges.push_back(G4Segment3D(baseA[i],baseB[i]));
|
||||
pEdges.push_back(G4Segment3D(baseA[i],baseA[k]));
|
||||
@@ -698,8 +699,8 @@ G4BoundingEnvelope::CreateListOfEdges(const G4Polygon3D& baseA,
|
||||
else if (nb == 1)
|
||||
{
|
||||
pEdges.resize(2*na);
|
||||
G4int k = na - 1;
|
||||
for (G4int i=0; i<na; ++i)
|
||||
std::size_t k = na - 1;
|
||||
for (std::size_t i=0; i<na; ++i)
|
||||
{
|
||||
pEdges.push_back(G4Segment3D(baseA[i],baseA[k]));
|
||||
pEdges.push_back(G4Segment3D(baseA[i],baseB[0]));
|
||||
@@ -709,8 +710,8 @@ G4BoundingEnvelope::CreateListOfEdges(const G4Polygon3D& baseA,
|
||||
else if (na == 1)
|
||||
{
|
||||
pEdges.resize(2*nb);
|
||||
G4int k = nb - 1;
|
||||
for (G4int i=0; i<nb; ++i)
|
||||
std::size_t k = nb - 1;
|
||||
for (std::size_t i=0; i<nb; ++i)
|
||||
{
|
||||
pEdges.push_back(G4Segment3D(baseB[i],baseB[k]));
|
||||
pEdges.push_back(G4Segment3D(baseB[i],baseA[0]));
|
||||
@@ -730,12 +731,12 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
|
||||
{
|
||||
// Find centers of the bases and internal point of the prism
|
||||
//
|
||||
G4int na = baseA.size();
|
||||
G4int nb = baseB.size();
|
||||
std::size_t na = baseA.size();
|
||||
std::size_t nb = baseB.size();
|
||||
G4Point3D pa(0.,0.,0.), pb(0.,0.,0.), p0;
|
||||
G4Normal3D norm;
|
||||
for (G4int i=0; i<na; ++i) pa += baseA[i];
|
||||
for (G4int i=0; i<nb; ++i) pb += baseB[i];
|
||||
for (std::size_t i=0; i<na; ++i) pa += baseA[i];
|
||||
for (std::size_t i=0; i<nb; ++i) pb += baseB[i];
|
||||
pa /= na; pb /= nb; p0 = (pa+pb)/2.;
|
||||
|
||||
// Create list of planes
|
||||
@@ -743,8 +744,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
|
||||
pPlanes.clear();
|
||||
if (na == nb) // bases with equal number of vertices
|
||||
{
|
||||
G4int k = na - 1;
|
||||
for (G4int i=0; i<na; ++i)
|
||||
std::size_t k = na - 1;
|
||||
for (std::size_t i=0; i<na; ++i)
|
||||
{
|
||||
norm = (baseB[k]-baseA[i]).cross(baseA[k]-baseB[i]);
|
||||
if (norm.mag2() > kCarTolerance)
|
||||
@@ -766,8 +767,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
|
||||
}
|
||||
else if (nb == 1) // baseB has one vertex
|
||||
{
|
||||
G4int k = na - 1;
|
||||
for (G4int i=0; i<na; ++i)
|
||||
std::size_t k = na - 1;
|
||||
for (std::size_t i=0; i<na; ++i)
|
||||
{
|
||||
norm = (baseA[i]-baseB[0]).cross(baseA[k]-baseB[0]);
|
||||
if (norm.mag2() > kCarTolerance)
|
||||
@@ -784,8 +785,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
|
||||
}
|
||||
else if (na == 1) // baseA has one vertex
|
||||
{
|
||||
G4int k = nb - 1;
|
||||
for (G4int i=0; i<nb; ++i)
|
||||
std::size_t k = nb - 1;
|
||||
for (std::size_t i=0; i<nb; ++i)
|
||||
{
|
||||
norm = (baseB[i]-baseA[0]).cross(baseB[k]-baseA[0]);
|
||||
if (norm.mag2() > kCarTolerance)
|
||||
@@ -803,8 +804,8 @@ G4BoundingEnvelope::CreateListOfPlanes(const G4Polygon3D& baseA,
|
||||
|
||||
// Ensure that normals of the planes point to outside
|
||||
//
|
||||
G4int nplanes = pPlanes.size();
|
||||
for (G4int i=0; i<nplanes; ++i)
|
||||
std::size_t nplanes = pPlanes.size();
|
||||
for (std::size_t i=0; i<nplanes; ++i)
|
||||
{
|
||||
pPlanes[i].normalize();
|
||||
if (pPlanes[i].distance(p0) > 0)
|
||||
@@ -830,8 +831,8 @@ G4BoundingEnvelope::ClipEdgesByVoxel(const std::vector<G4Segment3D>& pEdges,
|
||||
G4Point3D emin = pExtent.first;
|
||||
G4Point3D emax = pExtent.second;
|
||||
|
||||
G4int nedges = pEdges.size();
|
||||
for (G4int k=0; k<nedges; ++k)
|
||||
std::size_t nedges = pEdges.size();
|
||||
for (std::size_t k=0; k<nedges; ++k)
|
||||
{
|
||||
G4Point3D p1 = pEdges[k].first;
|
||||
G4Point3D p2 = pEdges[k].second;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include "geomdefs.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
#include "G4Plane3D.hh"
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@@ -75,7 +75,7 @@ G4double G4GeomTools::QuadArea(const G4TwoVector& A,
|
||||
|
||||
G4double G4GeomTools::PolygonArea(const G4TwoVectorList& p)
|
||||
{
|
||||
G4int n = p.size();
|
||||
G4int n = (G4int)p.size();
|
||||
if (n < 3) return 0.0; // degenerate polygon
|
||||
G4double area = p[n-1].x()*p[0].y() - p[0].x()*p[n-1].y();
|
||||
for(G4int i=1; i<n; ++i)
|
||||
@@ -145,7 +145,7 @@ G4bool G4GeomTools::PointInTriangle(const G4TwoVector& A,
|
||||
G4bool G4GeomTools::PointInPolygon(const G4TwoVector& p,
|
||||
const G4TwoVectorList& v)
|
||||
{
|
||||
G4int Nv = v.size();
|
||||
G4int Nv = (G4int)v.size();
|
||||
G4bool in = false;
|
||||
for (G4int i = 0, k = Nv - 1; i < Nv; k = i++)
|
||||
{
|
||||
@@ -169,7 +169,7 @@ G4bool G4GeomTools::IsConvex(const G4TwoVectorList& polygon)
|
||||
|
||||
G4bool gotNegative = false;
|
||||
G4bool gotPositive = false;
|
||||
G4int n = polygon.size();
|
||||
G4int n = (G4int)polygon.size();
|
||||
if (n <= 0) return false;
|
||||
for (G4int icur=0; icur<n; ++icur)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ G4bool G4GeomTools::TriangulatePolygon(const G4TwoVectorList& polygon,
|
||||
std::vector<G4int> triangles;
|
||||
G4bool reply = TriangulatePolygon(polygon,triangles);
|
||||
|
||||
G4int n = triangles.size();
|
||||
G4int n = (G4int)triangles.size();
|
||||
for (G4int i=0; i<n; ++i) result.push_back(polygon[triangles[i]]);
|
||||
return reply;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ G4bool G4GeomTools::TriangulatePolygon(const G4TwoVectorList& polygon,
|
||||
|
||||
// allocate and initialize list of Vertices in polygon
|
||||
//
|
||||
G4int n = polygon.size();
|
||||
G4int n = (G4int)polygon.size();
|
||||
if (n < 3) return false;
|
||||
|
||||
// we want a counter-clockwise polygon in V
|
||||
@@ -312,7 +312,7 @@ void G4GeomTools::RemoveRedundantVertices(G4TwoVectorList& polygon,
|
||||
// set special value to mark vertices for removal
|
||||
G4double removeIt = kInfinity;
|
||||
|
||||
G4int nv = polygon.size();
|
||||
G4int nv = (G4int)polygon.size();
|
||||
|
||||
// Main loop: check every three consecutive points, if the points
|
||||
// are collinear then mark middle point for removal
|
||||
@@ -620,7 +620,7 @@ G4ThreeVector G4GeomTools::QuadAreaNormal(const G4ThreeVector& A,
|
||||
|
||||
G4ThreeVector G4GeomTools::PolygonAreaNormal(const G4ThreeVectorList& p)
|
||||
{
|
||||
G4int n = p.size();
|
||||
G4int n = (G4int)p.size();
|
||||
if (n < 3) return G4ThreeVector(0,0,0); // degerate polygon
|
||||
G4ThreeVector normal = p[n-1].cross(p[0]);
|
||||
for(G4int i=1; i<n; ++i)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "G4Timer.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
#include "G4ios.hh"
|
||||
@@ -78,7 +79,7 @@ G4GeometryManager::~G4GeometryManager()
|
||||
G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose,
|
||||
G4VPhysicalVolume* pVolume)
|
||||
{
|
||||
if (!fIsClosed)
|
||||
if (!fIsClosed && G4Threading::IsMasterThread())
|
||||
{
|
||||
if (pVolume != nullptr)
|
||||
{
|
||||
@@ -101,7 +102,7 @@ G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose,
|
||||
//
|
||||
void G4GeometryManager::OpenGeometry(G4VPhysicalVolume* pVolume)
|
||||
{
|
||||
if (fIsClosed)
|
||||
if (fIsClosed && G4Threading::IsMasterThread())
|
||||
{
|
||||
if (pVolume != nullptr)
|
||||
{
|
||||
@@ -357,7 +358,7 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
|
||||
//
|
||||
// Get total memory use
|
||||
//
|
||||
G4int i, nStat = stats.size();
|
||||
G4int i, nStat = (G4int)stats.size();
|
||||
G4long totalMemory = 0;
|
||||
|
||||
for( i=0; i<nStat; ++i ) { totalMemory += stats[i].GetMemoryUse(); }
|
||||
|
||||
@@ -88,27 +88,14 @@ void G4LogicalVolumeStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
std::size_t i = 0;
|
||||
G4LogicalVolumeStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "Deleting Logical Volumes ... ";
|
||||
#endif
|
||||
|
||||
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
if (*pos != nullptr) { (*pos)->Lock(); delete *pos; }
|
||||
++i;
|
||||
}
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
if (store->size() < i-1)
|
||||
{ G4cout << "No volumes deleted. Already deleted by user ?" << G4endl; }
|
||||
else
|
||||
{ G4cout << i-1 << " volumes deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
|
||||
@@ -90,26 +90,14 @@ void G4PhysicalVolumeStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
std::size_t i=0;
|
||||
G4PhysicalVolumeStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "Deleting Physical Volumes ... ";
|
||||
#endif
|
||||
|
||||
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
delete *pos; ++i;
|
||||
delete *pos;
|
||||
}
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
if (store->size() < i-1)
|
||||
{ G4cout << "No volumes deleted. Already deleted by user ?" << G4endl; }
|
||||
else
|
||||
{ G4cout << i-1 << " volumes deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
|
||||
@@ -175,7 +175,7 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
|
||||
// its material to the list if not already present
|
||||
//
|
||||
G4Region* currentRegion = nullptr;
|
||||
size_t noDaughters = lv->GetNoDaughters();
|
||||
std::size_t noDaughters = lv->GetNoDaughters();
|
||||
G4Material* volMat = lv->GetMaterial();
|
||||
if((volMat == nullptr) && fInMassGeometry)
|
||||
{
|
||||
@@ -217,10 +217,10 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
|
||||
|
||||
if (pParam->GetMaterialScanner() != nullptr)
|
||||
{
|
||||
size_t matNo = pParam->GetMaterialScanner()->GetNumberOfMaterials();
|
||||
for (size_t mat=0; mat<matNo; ++mat)
|
||||
std::size_t matNo = pParam->GetMaterialScanner()->GetNumberOfMaterials();
|
||||
for (std::size_t mat=0; mat<matNo; ++mat)
|
||||
{
|
||||
volMat = pParam->GetMaterialScanner()->GetMaterial(mat);
|
||||
volMat = pParam->GetMaterialScanner()->GetMaterial((G4int)mat);
|
||||
if(!volMat && fInMassGeometry)
|
||||
{
|
||||
std::ostringstream message;
|
||||
@@ -242,10 +242,10 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t repNo = daughterPVol->GetMultiplicity();
|
||||
for (size_t rep=0; rep<repNo; ++rep)
|
||||
std::size_t repNo = daughterPVol->GetMultiplicity();
|
||||
for (std::size_t rep=0; rep<repNo; ++rep)
|
||||
{
|
||||
volMat = pParam->ComputeMaterial(rep, daughterPVol);
|
||||
volMat = pParam->ComputeMaterial((G4int)rep, daughterPVol);
|
||||
if((volMat == nullptr) && fInMassGeometry)
|
||||
{
|
||||
std::ostringstream message;
|
||||
@@ -270,7 +270,7 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i=0; i<noDaughters; ++i)
|
||||
for (std::size_t i=0; i<noDaughters; ++i)
|
||||
{
|
||||
G4LogicalVolume* daughterLVol = lv->GetDaughter(i)->GetLogicalVolume();
|
||||
if (!daughterLVol->IsRootRegion())
|
||||
@@ -416,7 +416,7 @@ G4bool G4Region::BelongsTo(G4VPhysicalVolume* thePhys) const
|
||||
G4LogicalVolume* currLog = thePhys->GetLogicalVolume();
|
||||
if (currLog->GetRegion()==this) {return true;}
|
||||
|
||||
G4int nDaughters = currLog->GetNoDaughters();
|
||||
std::size_t nDaughters = currLog->GetNoDaughters();
|
||||
while (nDaughters--) // Loop checking, 06.08.2015, G.Cosmo
|
||||
{
|
||||
if (BelongsTo(currLog->GetDaughter(nDaughters))) {return true;}
|
||||
@@ -475,12 +475,12 @@ G4Region* G4Region::GetParentRegion(G4bool& unique) const
|
||||
//
|
||||
for(auto lvItr=lvStore->cbegin(); lvItr!=lvStore->cend(); ++lvItr)
|
||||
{
|
||||
G4int nD = (*lvItr)->GetNoDaughters();
|
||||
std::size_t nD = (*lvItr)->GetNoDaughters();
|
||||
G4Region* aR = (*lvItr)->GetRegion();
|
||||
|
||||
// Loop over all daughters of each logical volume
|
||||
//
|
||||
for(auto iD=0; iD<nD; ++iD)
|
||||
for(std::size_t iD=0; iD<nD; ++iD)
|
||||
{
|
||||
if((*lvItr)->GetDaughter(iD)->GetLogicalVolume()->GetRegion()==this)
|
||||
{
|
||||
|
||||
@@ -91,26 +91,14 @@ void G4RegionStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
std::size_t i=0;
|
||||
G4RegionStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "Deleting Regions ... ";
|
||||
#endif
|
||||
|
||||
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
delete *pos; ++i;
|
||||
delete *pos;
|
||||
}
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
if (store->size() < i-1)
|
||||
{ G4cout << "No regions deleted. Already deleted by user ?" << G4endl; }
|
||||
else
|
||||
{ G4cout << i-1 << " regions deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
@@ -338,8 +326,8 @@ void G4RegionStore::SetWorldVolume()
|
||||
//
|
||||
G4PhysicalVolumeStore* fPhysicalVolumeStore
|
||||
= G4PhysicalVolumeStore::GetInstance();
|
||||
size_t nPhys = fPhysicalVolumeStore->size();
|
||||
for(size_t iPhys=0; iPhys<nPhys; ++iPhys)
|
||||
std::size_t nPhys = fPhysicalVolumeStore->size();
|
||||
for(std::size_t iPhys=0; iPhys<nPhys; ++iPhys)
|
||||
{
|
||||
G4VPhysicalVolume* fPhys = (*fPhysicalVolumeStore)[iPhys];
|
||||
if(fPhys->GetMotherLogical() != nullptr) { continue; } // not a world volume
|
||||
|
||||
@@ -62,7 +62,7 @@ G4SmartVoxelHeader::G4SmartVoxelHeader(G4LogicalVolume* pVolume,
|
||||
fmaxEquivalent(pSlice),
|
||||
fparamAxis(kUndefined)
|
||||
{
|
||||
size_t nDaughters = pVolume->GetNoDaughters();
|
||||
std::size_t nDaughters = pVolume->GetNoDaughters();
|
||||
|
||||
// Determine whether daughter is replicated
|
||||
//
|
||||
@@ -121,7 +121,7 @@ G4SmartVoxelHeader::~G4SmartVoxelHeader()
|
||||
// Manually destroy underlying nodes/headers
|
||||
// Delete collected headers and nodes once only
|
||||
//
|
||||
size_t node, proxy, maxNode=fslices.size();
|
||||
std::size_t node, proxy, maxNode=fslices.size();
|
||||
G4SmartVoxelProxy* lastProxy = nullptr;
|
||||
G4SmartVoxelNode *dyingNode, *lastNode=nullptr;
|
||||
G4SmartVoxelHeader *dyingHeader, *lastHeader=nullptr;
|
||||
@@ -179,7 +179,7 @@ G4bool G4SmartVoxelHeader::operator == (const G4SmartVoxelHeader& pHead) const
|
||||
&& (GetMinExtent() == pHead.GetMinExtent())
|
||||
&& (GetMaxExtent() == pHead.GetMaxExtent()) )
|
||||
{
|
||||
size_t node, maxNode;
|
||||
std::size_t node, maxNode;
|
||||
G4SmartVoxelProxy *leftProxy, *rightProxy;
|
||||
G4SmartVoxelHeader *leftHeader, *rightHeader;
|
||||
G4SmartVoxelNode *leftNode, *rightNode;
|
||||
@@ -239,13 +239,13 @@ G4bool G4SmartVoxelHeader::operator == (const G4SmartVoxelHeader& pHead) const
|
||||
void G4SmartVoxelHeader::BuildVoxels(G4LogicalVolume* pVolume)
|
||||
{
|
||||
G4VoxelLimits limits; // Create `unlimited' limits object
|
||||
size_t nDaughters = pVolume->GetNoDaughters();
|
||||
std::size_t nDaughters = pVolume->GetNoDaughters();
|
||||
|
||||
G4VolumeNosVector targetList;
|
||||
targetList.reserve(nDaughters);
|
||||
for (size_t i=0; i<nDaughters; ++i)
|
||||
for (std::size_t i=0; i<nDaughters; ++i)
|
||||
{
|
||||
targetList.push_back(i);
|
||||
targetList.push_back((G4int)i);
|
||||
}
|
||||
BuildVoxelsWithinLimits(pVolume, limits, &targetList);
|
||||
}
|
||||
@@ -444,7 +444,7 @@ G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
|
||||
G4double goodSliceScore=kInfinity, testSliceScore;
|
||||
EAxis goodSliceAxis = kXAxis;
|
||||
EAxis testAxis = kXAxis;
|
||||
size_t node, maxNode, iaxis;
|
||||
std::size_t node, maxNode, iaxis;
|
||||
G4VoxelLimits noLimits;
|
||||
|
||||
// Try all non-limited cartesian axes
|
||||
@@ -573,8 +573,8 @@ G4SmartVoxelHeader::BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
|
||||
//
|
||||
void G4SmartVoxelHeader::BuildEquivalentSliceNos()
|
||||
{
|
||||
size_t sliceNo, minNo, maxNo, equivNo;
|
||||
size_t maxNode = fslices.size();
|
||||
std::size_t sliceNo, minNo, maxNo, equivNo;
|
||||
std::size_t maxNode = fslices.size();
|
||||
G4SmartVoxelNode *startNode, *sampleNode;
|
||||
for (sliceNo=0; sliceNo<maxNode; ++sliceNo)
|
||||
{
|
||||
@@ -599,8 +599,8 @@ void G4SmartVoxelHeader::BuildEquivalentSliceNos()
|
||||
for (equivNo=minNo; equivNo<=maxNo; ++equivNo)
|
||||
{
|
||||
sampleNode = fslices[equivNo]->GetNode();
|
||||
sampleNode->SetMinEquivalentSliceNo(minNo);
|
||||
sampleNode->SetMaxEquivalentSliceNo(maxNo);
|
||||
sampleNode->SetMinEquivalentSliceNo((G4int)minNo);
|
||||
sampleNode->SetMaxEquivalentSliceNo((G4int)maxNo);
|
||||
}
|
||||
// Advance outer loop to end of equivalent group
|
||||
//
|
||||
@@ -620,8 +620,8 @@ void G4SmartVoxelHeader::BuildEquivalentSliceNos()
|
||||
//
|
||||
void G4SmartVoxelHeader::CollectEquivalentNodes()
|
||||
{
|
||||
size_t sliceNo, maxNo, equivNo;
|
||||
size_t maxNode=fslices.size();
|
||||
std::size_t sliceNo, maxNo, equivNo;
|
||||
std::size_t maxNode=fslices.size();
|
||||
G4SmartVoxelNode* equivNode;
|
||||
G4SmartVoxelProxy* equivProxy;
|
||||
|
||||
@@ -667,8 +667,8 @@ void G4SmartVoxelHeader::CollectEquivalentNodes()
|
||||
//
|
||||
void G4SmartVoxelHeader::CollectEquivalentHeaders()
|
||||
{
|
||||
size_t sliceNo, maxNo, equivNo;
|
||||
size_t maxNode = fslices.size();
|
||||
std::size_t sliceNo, maxNo, equivNo;
|
||||
std::size_t maxNode = fslices.size();
|
||||
G4SmartVoxelHeader *equivHeader, *sampleHeader;
|
||||
G4SmartVoxelProxy *equivProxy;
|
||||
|
||||
@@ -750,10 +750,10 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
G4VSolid *targetSolid;
|
||||
G4AffineTransform targetTransform;
|
||||
G4bool replicated;
|
||||
size_t nCandidates = pCandidates->size();
|
||||
size_t nVol, nNode, targetVolNo;
|
||||
std::size_t nCandidates = pCandidates->size();
|
||||
std::size_t nVol, nNode, targetVolNo;
|
||||
G4VoxelLimits noLimits;
|
||||
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "**** G4SmartVoxelHeader::BuildNodes" << G4endl
|
||||
<< " Limits = " << pLimits << G4endl
|
||||
@@ -825,15 +825,15 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
{
|
||||
// Find solid
|
||||
//
|
||||
targetSolid = pParam->ComputeSolid(targetVolNo,pDaughter);
|
||||
targetSolid = pParam->ComputeSolid((G4int)targetVolNo,pDaughter);
|
||||
|
||||
// Setup solid
|
||||
//
|
||||
targetSolid->ComputeDimensions(pParam,targetVolNo,pDaughter);
|
||||
targetSolid->ComputeDimensions(pParam,(G4int)targetVolNo,pDaughter);
|
||||
|
||||
// Setup transform
|
||||
//
|
||||
pParam->ComputeTransformation(targetVolNo,pDaughter);
|
||||
pParam->ComputeTransformation((G4int)targetVolNo,pDaughter);
|
||||
targetTransform = G4AffineTransform(pDaughter->GetRotation(),
|
||||
pDaughter->GetTranslation());
|
||||
}
|
||||
@@ -966,7 +966,7 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
for (nNode=0; G4long(nNode)<noNodes; ++nNode)
|
||||
{
|
||||
G4SmartVoxelNode *pNode;
|
||||
pNode = new G4SmartVoxelNode(nNode);
|
||||
pNode = new G4SmartVoxelNode((G4int)nNode);
|
||||
if (pNode == nullptr)
|
||||
{
|
||||
G4Exception("G4SmartVoxelHeader::BuildNodes()", "GeomMgt0003",
|
||||
@@ -1064,11 +1064,11 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
|
||||
G4double G4SmartVoxelHeader::CalculateQuality(G4ProxyVector *pSlice)
|
||||
{
|
||||
G4double quality;
|
||||
size_t nNodes = pSlice->size();
|
||||
size_t noContained, maxContained=0, sumContained=0, sumNonEmptyNodes=0;
|
||||
std::size_t nNodes = pSlice->size();
|
||||
std::size_t noContained, maxContained=0, sumContained=0, sumNonEmptyNodes=0;
|
||||
G4SmartVoxelNode *node;
|
||||
|
||||
for (size_t i=0; i<nNodes; ++i)
|
||||
for (std::size_t i=0; i<nNodes; ++i)
|
||||
{
|
||||
if ((*pSlice)[i]->IsNode())
|
||||
{
|
||||
@@ -1130,8 +1130,8 @@ G4double G4SmartVoxelHeader::CalculateQuality(G4ProxyVector *pSlice)
|
||||
void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
G4VoxelLimits pLimits)
|
||||
{
|
||||
size_t refinedDepth=0, minVolumes;
|
||||
size_t maxNode = fslices.size();
|
||||
std::size_t refinedDepth=0, minVolumes;
|
||||
std::size_t maxNode = fslices.size();
|
||||
|
||||
if (pLimits.IsXLimited())
|
||||
{
|
||||
@@ -1163,7 +1163,7 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
|
||||
if (refinedDepth<2)
|
||||
{
|
||||
size_t targetNo, noContainedDaughters, minNo, maxNo, replaceNo, i;
|
||||
std::size_t targetNo, noContainedDaughters, minNo, maxNo, replaceNo, i;
|
||||
G4double sliceWidth = (fmaxExtent-fminExtent)/maxNode;
|
||||
G4VoxelLimits newLimits;
|
||||
G4SmartVoxelNode* targetNode;
|
||||
@@ -1194,7 +1194,7 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
targetList->reserve(noContainedDaughters);
|
||||
for (i=0; i<noContainedDaughters; ++i)
|
||||
{
|
||||
targetList->push_back(targetNode->GetVolume(i));
|
||||
targetList->push_back(targetNode->GetVolume((G4int)i));
|
||||
}
|
||||
minNo = targetNode->GetMinEquivalentSliceNo();
|
||||
maxNo = targetNode->GetMaxEquivalentSliceNo();
|
||||
@@ -1232,15 +1232,15 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
newLimits.AddLimit(faxis,fminExtent+sliceWidth*minNo,
|
||||
fminExtent+sliceWidth*(maxNo+1));
|
||||
replaceHeader = new G4SmartVoxelHeader(pVolume,newLimits,
|
||||
targetList,replaceNo);
|
||||
targetList,(G4int)replaceNo);
|
||||
if (replaceHeader == nullptr)
|
||||
{
|
||||
G4Exception("G4SmartVoxelHeader::RefineNodes()", "GeomMgt0003",
|
||||
FatalException, "Refined VoxelHeader allocation error.");
|
||||
return;
|
||||
}
|
||||
replaceHeader->SetMinEquivalentSliceNo(minNo);
|
||||
replaceHeader->SetMaxEquivalentSliceNo(maxNo);
|
||||
replaceHeader->SetMinEquivalentSliceNo((G4int)minNo);
|
||||
replaceHeader->SetMaxEquivalentSliceNo((G4int)maxNo);
|
||||
replaceHeaderProxy = new G4SmartVoxelProxy(replaceHeader);
|
||||
if (replaceHeaderProxy == nullptr)
|
||||
{
|
||||
@@ -1271,13 +1271,13 @@ void G4SmartVoxelHeader::RefineNodes(G4LogicalVolume* pVolume,
|
||||
//
|
||||
G4bool G4SmartVoxelHeader::AllSlicesEqual() const
|
||||
{
|
||||
size_t noSlices = fslices.size();
|
||||
std::size_t noSlices = fslices.size();
|
||||
G4SmartVoxelProxy* refProxy;
|
||||
|
||||
if (noSlices>1)
|
||||
{
|
||||
refProxy=fslices[0];
|
||||
for (size_t i=1; i<noSlices; ++i)
|
||||
for (std::size_t i=1; i<noSlices; ++i)
|
||||
{
|
||||
if (refProxy!=fslices[i])
|
||||
{
|
||||
@@ -1296,9 +1296,9 @@ std::ostream& operator << (std::ostream& os, const G4SmartVoxelHeader& h)
|
||||
{
|
||||
os << "Axis = " << G4int(h.faxis) << G4endl;
|
||||
G4SmartVoxelProxy *collectNode=nullptr, *collectHead=nullptr;
|
||||
G4int collectNodeNo = 0;
|
||||
G4int collectHeadNo = 0;
|
||||
size_t i, j;
|
||||
std::size_t collectNodeNo = 0;
|
||||
std::size_t collectHeadNo = 0;
|
||||
std::size_t i, j;
|
||||
G4bool haveHeaders = false;
|
||||
|
||||
for (i=0; i<h.fslices.size(); ++i)
|
||||
@@ -1309,9 +1309,9 @@ std::ostream& operator << (std::ostream& os, const G4SmartVoxelHeader& h)
|
||||
if (h.fslices[i]!=collectNode)
|
||||
{
|
||||
os << "{";
|
||||
for (size_t k=0; k<h.fslices[i]->GetNode()->GetNoContained(); ++k)
|
||||
for (std::size_t k=0; k<h.fslices[i]->GetNode()->GetNoContained(); ++k)
|
||||
{
|
||||
os << " " << h.fslices[i]->GetNode()->GetVolume(k);
|
||||
os << " " << h.fslices[i]->GetNode()->GetVolume((G4int)k);
|
||||
}
|
||||
os << " }" << G4endl;
|
||||
collectNode = h.fslices[i];
|
||||
|
||||
@@ -52,7 +52,7 @@ G4bool G4SmartVoxelNode::operator == (const G4SmartVoxelNode& v) const
|
||||
{
|
||||
for (std::size_t node=0; node<maxNode; ++node)
|
||||
{
|
||||
if (GetVolume(node) != v.GetVolume(node))
|
||||
if (GetVolume((G4int)node) != v.GetVolume((G4int)node))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,13 +118,13 @@ G4long G4SmartVoxelStat::GetMemoryUse() const
|
||||
//
|
||||
void G4SmartVoxelStat::CountHeadsAndNodes( const G4SmartVoxelHeader* head )
|
||||
{
|
||||
G4int numSlices = head->GetNoSlices();
|
||||
std::size_t numSlices = head->GetNoSlices();
|
||||
|
||||
pointers += numSlices;
|
||||
|
||||
const G4SmartVoxelProxy* lastProxy = nullptr;
|
||||
|
||||
for(auto i=0; i<numSlices; ++i)
|
||||
for(std::size_t i=0; i<numSlices; ++i)
|
||||
{
|
||||
const G4SmartVoxelProxy *proxy = head->GetSlice(i);
|
||||
if (proxy == lastProxy) continue;
|
||||
|
||||
@@ -87,26 +87,14 @@ void G4SolidStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
std::size_t i = 0;
|
||||
G4SolidStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "Deleting Solids ... ";
|
||||
#endif
|
||||
|
||||
for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
delete *pos; ++i;
|
||||
delete *pos;
|
||||
}
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
if (store->size() < i-1)
|
||||
{ G4cout << "No solids deleted. Already deleted by user ?" << G4endl; }
|
||||
else
|
||||
{ G4cout << i-1 << " solids deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
|
||||
@@ -496,7 +496,7 @@ G4VSolid::CalculateClippedPolygonExtent(G4ThreeVectorList& pPolygon,
|
||||
G4double component;
|
||||
|
||||
ClipPolygon(pPolygon,pVoxelLimit,pAxis);
|
||||
noLeft = pPolygon.size();
|
||||
noLeft = (G4int)pPolygon.size();
|
||||
|
||||
if ( noLeft )
|
||||
{
|
||||
@@ -614,7 +614,7 @@ G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
|
||||
const G4VoxelLimits& pVoxelLimit ) const
|
||||
{
|
||||
G4int i;
|
||||
G4int noVertices=pPolygon.size();
|
||||
G4int noVertices = (G4int)pPolygon.size();
|
||||
G4ThreeVector vEnd,vStart;
|
||||
|
||||
for (i = 0 ; i < noVertices ; ++i )
|
||||
|
||||
@@ -5,28 +5,44 @@ which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
## 2022-11-23 John Apostolakis (geomnav-V11-00-09)
|
||||
- G4MultiLevelLocator: refresh candidate intersection point when needed
|
||||
|
||||
## 2022-11-10 John Apostolakis (geomnav-V11-00-08)
|
||||
- Improved diagnostic message in G4MultiLevelLocator - they missed to print
|
||||
the stored information on trial integration steps in one error case.
|
||||
- G4MultiLevelLocator: small print formatting change.
|
||||
|
||||
## 2022-11-10 Gabriele Cosmo (geomnav-V11-00-07)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-10-05 Gabriele Cosmo (geomnav-V11-00-06)
|
||||
- Fixed compilation warnings on Intel-icx compiler for variables set
|
||||
but not used.
|
||||
|
||||
## 2022-05-10 Guilherme Amadio (geomnav-V11-00-05)
|
||||
- G4Navigator: minor improvements to ComputeSafety/ComputeStep/LocateGlobalPointAndSetup
|
||||
- G4Navigator: minor improvements to ComputeSafety(), ComputeStep()
|
||||
and LocateGlobalPointAndSetup().
|
||||
|
||||
## 2022-03-11 Pedro Arce (geomnav-V11-00-04)
|
||||
- `G4RegularNavigation`: reset the zero step counter when a non-zero step was performed, to avoid aborted events. Correct tabulation.
|
||||
Fixes as proposed in [GitHub PR #38](https://github.com/Geant4/geant4/pull/38)
|
||||
- G4RegularNavigation: reset the zero step counter when a non-zero step was
|
||||
performed, to avoid aborted events. Corrected tabulation.
|
||||
Fixes as proposed in [GitHub PR #38](https://github.com/Geant4/geant4/pull/38)
|
||||
|
||||
## 2022-02-14 Sergio Losilla (geomnav-V11-00-03)
|
||||
- /geometry/run/test also checks for overlaps in parallel worlds if
|
||||
/geometry/run/check_parallel is set to true.
|
||||
|
||||
## 2022-01-08 Gabriele Cosmo (geomnav-V11-00-02)
|
||||
- `G4VIntersectionLocator`: Fixed compilation warning on Intel-icx compiler
|
||||
- G4VIntersectionLocator: Fixed compilation warning on Intel-icx compiler
|
||||
for unused data.
|
||||
|
||||
## 2022-01-05 Jonas Hahnfeld (geomnav-V11-00-01)
|
||||
- `G4TransportationManager`: Add constant `kMassNavigatorId`
|
||||
- `G4SafetyHelper`: Use it
|
||||
- G4TransportationManager: Add constant `kMassNavigatorId`.
|
||||
- G4SafetyHelper: Use it.
|
||||
|
||||
## 2021-12-10 Ben Morgan (geomnav-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
- Change to new Markdown History format.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ class G4ParameterisedNavigation : public G4VoxelNavigation
|
||||
EAxis fVoxelAxis = kUndefined;
|
||||
G4int fVoxelNoSlices = 0;
|
||||
G4double fVoxelSliceWidth = 0.0;
|
||||
size_t fVoxelNodeNo = 0;
|
||||
std::size_t fVoxelNodeNo = 0;
|
||||
G4SmartVoxelHeader* fVoxelHeader = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -69,11 +69,11 @@ class G4PartialPhantomParameterisation : public G4PhantomParameterisation
|
||||
|
||||
G4ThreeVector GetTranslation(const G4int copyNo ) const;
|
||||
|
||||
size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const;
|
||||
size_t GetMaterialIndex( size_t copyNo) const;
|
||||
std::size_t GetMaterialIndex( std::size_t nx, std::size_t ny, std::size_t nz) const;
|
||||
std::size_t GetMaterialIndex( std::size_t copyNo) const;
|
||||
|
||||
G4Material* GetMaterial( size_t nx, size_t ny, size_t nz) const;
|
||||
G4Material* GetMaterial( size_t copyNo ) const;
|
||||
G4Material* GetMaterial( std::size_t nx, std::size_t ny, std::size_t nz) const;
|
||||
G4Material* GetMaterial( std::size_t copyNo ) const;
|
||||
|
||||
void SetFilledIDs( std::multimap<G4int,G4int> fid )
|
||||
{
|
||||
@@ -89,11 +89,11 @@ class G4PartialPhantomParameterisation : public G4PhantomParameterisation
|
||||
|
||||
private:
|
||||
|
||||
void ComputeVoxelIndices(const G4int copyNo, size_t& nx,
|
||||
size_t& ny, size_t& nz ) const;
|
||||
void ComputeVoxelIndices(const G4int copyNo, std::size_t& nx,
|
||||
std::size_t& ny, std::size_t& nz ) const;
|
||||
// Convert the copyNo to voxel numbers in x, y and z.
|
||||
|
||||
void CheckCopyNo( const G4int copyNo ) const;
|
||||
void CheckCopyNo( const G4long copyNo ) const;
|
||||
// Check that the copy number is within limits.
|
||||
|
||||
private:
|
||||
|
||||
@@ -67,7 +67,7 @@ class G4Polyhedra;
|
||||
|
||||
class G4PhantomParameterisation : public G4VPVParameterisation
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
G4PhantomParameterisation();
|
||||
~G4PhantomParameterisation();
|
||||
@@ -122,21 +122,21 @@ class G4PhantomParameterisation : public G4VPVParameterisation
|
||||
|
||||
inline void SetMaterials(std::vector<G4Material*>& mates );
|
||||
|
||||
inline void SetMaterialIndices( size_t* matInd );
|
||||
inline void SetMaterialIndices( std::size_t* matInd );
|
||||
|
||||
void SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz );
|
||||
void SetNoVoxels( size_t nx, size_t ny, size_t nz );
|
||||
void SetNoVoxels( std::size_t nx, std::size_t ny, std::size_t nz );
|
||||
|
||||
inline G4double GetVoxelHalfX() const;
|
||||
inline G4double GetVoxelHalfY() const;
|
||||
inline G4double GetVoxelHalfZ() const;
|
||||
inline size_t GetNoVoxelsX() const;
|
||||
inline size_t GetNoVoxelsY() const;
|
||||
inline size_t GetNoVoxelsZ() const;
|
||||
inline size_t GetNoVoxels() const;
|
||||
inline std::size_t GetNoVoxelsX() const;
|
||||
inline std::size_t GetNoVoxelsY() const;
|
||||
inline std::size_t GetNoVoxelsZ() const;
|
||||
inline std::size_t GetNoVoxels() const;
|
||||
|
||||
inline std::vector<G4Material*> GetMaterials() const;
|
||||
inline size_t* GetMaterialIndices() const;
|
||||
inline std::size_t* GetMaterialIndices() const;
|
||||
inline G4VSolid* GetContainerSolid() const;
|
||||
|
||||
G4ThreeVector GetTranslation(const G4int copyNo ) const;
|
||||
@@ -144,11 +144,11 @@ class G4PhantomParameterisation : public G4VPVParameterisation
|
||||
G4bool SkipEqualMaterials() const;
|
||||
void SetSkipEqualMaterials( G4bool skip );
|
||||
|
||||
size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const;
|
||||
size_t GetMaterialIndex( size_t copyNo) const;
|
||||
std::size_t GetMaterialIndex( std::size_t nx, std::size_t ny, std::size_t nz) const;
|
||||
std::size_t GetMaterialIndex( std::size_t copyNo) const;
|
||||
|
||||
G4Material* GetMaterial( size_t nx, size_t ny, size_t nz) const;
|
||||
G4Material* GetMaterial( size_t copyNo ) const;
|
||||
G4Material* GetMaterial( std::size_t nx, std::size_t ny, std::size_t nz) const;
|
||||
G4Material* GetMaterial( std::size_t copyNo ) const;
|
||||
|
||||
void CheckVoxelsFillContainer( G4double contX, G4double contY,
|
||||
G4double contZ ) const;
|
||||
@@ -156,27 +156,27 @@ class G4PhantomParameterisation : public G4VPVParameterisation
|
||||
|
||||
private:
|
||||
|
||||
void ComputeVoxelIndices(const G4int copyNo, size_t& nx,
|
||||
size_t& ny, size_t& nz ) const;
|
||||
void ComputeVoxelIndices(const G4int copyNo, std::size_t& nx,
|
||||
std::size_t& ny, std::size_t& nz ) const;
|
||||
// Convert the copyNo to voxel numbers in x, y and z.
|
||||
|
||||
void CheckCopyNo( const G4int copyNo ) const;
|
||||
void CheckCopyNo( const G4long copyNo ) const;
|
||||
// Check that the copy number is within limits.
|
||||
|
||||
protected:
|
||||
|
||||
G4double fVoxelHalfX = 0.0, fVoxelHalfY = 0.0, fVoxelHalfZ = 0.0;
|
||||
// Half dimension of voxels (assume they are boxes).
|
||||
size_t fNoVoxelsX = 0, fNoVoxelsY = 0, fNoVoxelsZ = 0;
|
||||
std::size_t fNoVoxelsX = 0, fNoVoxelsY = 0, fNoVoxelsZ = 0;
|
||||
// Number of voxel in x, y and z dimensions.
|
||||
size_t fNoVoxelsXY = 0;
|
||||
std::size_t fNoVoxelsXY = 0;
|
||||
// Number of voxels in x times number of voxels in y (for speed-up).
|
||||
size_t fNoVoxels = 0;
|
||||
std::size_t fNoVoxels = 0;
|
||||
// Total number of voxels (for speed-up).
|
||||
|
||||
std::vector<G4Material*> fMaterials;
|
||||
// List of materials of the voxels.
|
||||
size_t* fMaterialIndices = nullptr;
|
||||
std::size_t* fMaterialIndices = nullptr;
|
||||
// Index in fMaterials that correspond to each voxel.
|
||||
|
||||
G4VSolid* fContainerSolid = nullptr;
|
||||
|
||||
@@ -38,7 +38,9 @@ SetVoxelDimensions( G4double halfx, G4double halfy, G4double halfz )
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
void G4PhantomParameterisation::SetNoVoxels( size_t nx, size_t ny, size_t nz )
|
||||
void G4PhantomParameterisation::SetNoVoxels( std::size_t nx,
|
||||
std::size_t ny,
|
||||
std::size_t nz )
|
||||
{
|
||||
fNoVoxelsX = nx;
|
||||
fNoVoxelsY = ny;
|
||||
@@ -56,7 +58,7 @@ void G4PhantomParameterisation::SetMaterials( std::vector<G4Material*>& mates )
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
void G4PhantomParameterisation::SetMaterialIndices( size_t* matInd )
|
||||
void G4PhantomParameterisation::SetMaterialIndices( std::size_t* matInd )
|
||||
{
|
||||
fMaterialIndices = matInd;
|
||||
}
|
||||
@@ -84,28 +86,28 @@ G4double G4PhantomParameterisation::GetVoxelHalfZ() const
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxelsX() const
|
||||
std::size_t G4PhantomParameterisation::GetNoVoxelsX() const
|
||||
{
|
||||
return fNoVoxelsX;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxelsY() const
|
||||
std::size_t G4PhantomParameterisation::GetNoVoxelsY() const
|
||||
{
|
||||
return fNoVoxelsY;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxelsZ() const
|
||||
std::size_t G4PhantomParameterisation::GetNoVoxelsZ() const
|
||||
{
|
||||
return fNoVoxelsZ;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t G4PhantomParameterisation::GetNoVoxels() const
|
||||
std::size_t G4PhantomParameterisation::GetNoVoxels() const
|
||||
{
|
||||
return fNoVoxels;
|
||||
}
|
||||
@@ -119,7 +121,7 @@ std::vector<G4Material*> G4PhantomParameterisation::GetMaterials() const
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
inline
|
||||
size_t* G4PhantomParameterisation::GetMaterialIndices() const
|
||||
std::size_t* G4PhantomParameterisation::GetMaterialIndices() const
|
||||
{
|
||||
return fMaterialIndices;
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ class G4TransportationManager
|
||||
// Set the world volume for tracking
|
||||
// This method is to be invoked by G4RunManagerKernel.
|
||||
|
||||
inline size_t GetNoActiveNavigators() const;
|
||||
inline std::size_t GetNoActiveNavigators() const;
|
||||
inline std::vector<G4Navigator*>::iterator GetActiveNavigatorsIterator();
|
||||
// Return an iterator to the list of active navigators
|
||||
|
||||
inline size_t GetNoWorlds() const;
|
||||
inline std::size_t GetNoWorlds() const;
|
||||
inline std::vector<G4VPhysicalVolume*>::iterator GetWorldsIterator();
|
||||
// Return an iterator to the list of registered worlds
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
void G4AuxiliaryNavServices::ReportTolerances()
|
||||
{
|
||||
G4int oldPrec = G4cout.precision(16);
|
||||
G4long oldPrec = G4cout.precision(16);
|
||||
|
||||
G4cout << " Cartesian Tolerance (kCarTolerance): "
|
||||
<< G4GeometryTolerance::GetInstance()->GetSurfaceTolerance()
|
||||
|
||||
@@ -121,7 +121,7 @@ G4bool G4BrentLocator::EstimateIntersectionPoint(
|
||||
|
||||
G4bool restoredFullEndpoint = false;
|
||||
|
||||
G4int oldprc; // cout, cerr precision
|
||||
G4long oldprc; // cout, cerr precision
|
||||
G4int substep_no = 0;
|
||||
|
||||
// Limits for substep number
|
||||
@@ -753,7 +753,7 @@ G4bool G4BrentLocator::EstimateIntersectionPoint(
|
||||
}
|
||||
else if( substep_no >= warn_substeps )
|
||||
{
|
||||
oldprc= G4cout.precision( 10 );
|
||||
oldprc = G4cout.precision( 10 );
|
||||
std::ostringstream message;
|
||||
message << "Many substeps while trying to locate intersection."
|
||||
<< G4endl
|
||||
|
||||
@@ -153,7 +153,7 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
|
||||
voxel_plane.SetVisAttributes(voxelsVisAttributes);
|
||||
|
||||
G4SmartVoxelProxy* slice = header->GetSlice(0);
|
||||
G4int slice_no = 0, no_slices = header->GetNoSlices();
|
||||
std::size_t slice_no = 0, no_slices = header->GetNoSlices();
|
||||
G4double beginning = header->GetMinExtent(),
|
||||
step = (header->GetMaxExtent()-beginning)/no_slices;
|
||||
|
||||
|
||||
@@ -133,8 +133,8 @@ void G4GeomTestVolume::TestOverlapInTree() const
|
||||
|
||||
// check overlaps for daughters
|
||||
G4LogicalVolume* logical = current->GetLogicalVolume();
|
||||
G4int ndaughters = logical->GetNoDaughters();
|
||||
for (G4int i=0; i<ndaughters; ++i)
|
||||
std::size_t ndaughters = logical->GetNoDaughters();
|
||||
for (std::size_t i=0; i<ndaughters; ++i)
|
||||
{
|
||||
G4VPhysicalVolume* daughter = logical->GetDaughter(i);
|
||||
daughter->CheckOverlaps(resolution, tolerance, verbosity, maxErr);
|
||||
@@ -142,7 +142,7 @@ void G4GeomTestVolume::TestOverlapInTree() const
|
||||
|
||||
// append the queue of volumes
|
||||
G4LogicalVolume* previousLogical = nullptr;
|
||||
for (G4int i=0; i<ndaughters; ++i)
|
||||
for (std::size_t i=0; i<ndaughters; ++i)
|
||||
{
|
||||
G4VPhysicalVolume* daughter = logical->GetDaughter(i);
|
||||
G4LogicalVolume* daughterLogical = daughter->GetLogicalVolume();
|
||||
@@ -194,7 +194,7 @@ void G4GeomTestVolume::TestRecursiveOverlap( G4int slevel, G4int depth )
|
||||
std::set<const G4LogicalVolume *> tested;
|
||||
|
||||
const G4LogicalVolume *logical = target->GetLogicalVolume();
|
||||
G4int nDaughter = logical->GetNoDaughters();
|
||||
G4int nDaughter = (G4int)logical->GetNoDaughters();
|
||||
for( auto iDaughter=0; iDaughter<nDaughter; ++iDaughter )
|
||||
{
|
||||
G4VPhysicalVolume *daughter = logical->GetDaughter(iDaughter);
|
||||
|
||||
@@ -49,7 +49,7 @@ std::ostream& operator<< ( std::ostream& os,
|
||||
//
|
||||
std::ostream& G4LocatorChangeLogger::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
G4LocatorChangeRecord::ReportVector( os, this->fName, *this );
|
||||
os.precision(oldprc);
|
||||
return os;
|
||||
@@ -65,7 +65,7 @@ std::ostream& G4LocatorChangeLogger::ReportEndChanges( std::ostream& os,
|
||||
using std::setw;
|
||||
G4int prec= 16;
|
||||
const G4bool confirm = true;
|
||||
G4int oldprc = os.precision(prec);
|
||||
G4long oldprc = os.precision(prec);
|
||||
|
||||
auto itrecA= startA.cbegin();
|
||||
auto itrecB= endB.cbegin();
|
||||
@@ -91,8 +91,6 @@ std::ostream& G4LocatorChangeLogger::ReportEndChanges( std::ostream& os,
|
||||
G4bool isLastA= false;
|
||||
G4bool isLastB= false;
|
||||
|
||||
G4int jA=0, jB=0;
|
||||
|
||||
G4int maxEvent = std::max( startA[ startA.size() - 1 ].GetCount() ,
|
||||
endB[ endB.size() - 1 ].GetCount() );
|
||||
G4int prevA = -1;
|
||||
@@ -173,14 +171,12 @@ std::ostream& G4LocatorChangeLogger::ReportEndChanges( std::ostream& os,
|
||||
if( advanceA )
|
||||
{
|
||||
++itrecA;
|
||||
if( !isLastA ) { ++jA; }
|
||||
eventA = isLastA ? maxEvent : (*itrecA).GetCount();
|
||||
}
|
||||
|
||||
if( advanceB )
|
||||
{
|
||||
++itrecB;
|
||||
if( !isLastB ) { ++jB; }
|
||||
eventB = isLastB ? maxEvent : (*itrecB).GetCount();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ std::ostream& G4LocatorChangeRecord::ReportVector ( std::ostream& os,
|
||||
return os;
|
||||
}
|
||||
|
||||
G4int oldprc = os.precision(prec);
|
||||
G4long oldprc = os.precision(prec);
|
||||
|
||||
// std::vector<G4LocatorChangeRecord>::const_iterator
|
||||
auto itRec
|
||||
@@ -104,17 +104,18 @@ G4LocatorChangeRecord::ReportEndChanges (
|
||||
using std::setw;
|
||||
G4int prec= 16;
|
||||
const G4bool confirm = true;
|
||||
G4int oldprc = os.precision(prec);
|
||||
G4long oldprc = os.precision(prec);
|
||||
|
||||
std::vector<G4LocatorChangeRecord>::const_iterator itrecA, itrecB;
|
||||
itrecA= startA.begin();
|
||||
itrecB= endB.begin();
|
||||
|
||||
os << "====================================================================="
|
||||
<< G4endl;
|
||||
os << " Size of individual change record: startA : " << startA.size()
|
||||
<< " endB : " << endB.size() << G4endl;
|
||||
os << "====================================================================="
|
||||
os << G4endl;
|
||||
os << "=========================================================================================";
|
||||
os << G4endl << " ** Change records: " << G4endl;
|
||||
os << " * endPoints A (start) and B (end): combined changes of AB intervals" << G4endl;
|
||||
os << " * Sizes of change records: start(A) : " << startA.size()
|
||||
<< " end(B) : " << endB.size() << G4endl;
|
||||
os << "========================================================================================="
|
||||
<< G4endl;
|
||||
|
||||
os << setw( 7 ) << "Change#" << " "
|
||||
@@ -132,8 +133,6 @@ G4LocatorChangeRecord::ReportEndChanges (
|
||||
G4bool isLastA= false;
|
||||
G4bool isLastB= false;
|
||||
|
||||
G4int jA=0, jB=0;
|
||||
|
||||
G4int maxEvent = std::max( startA[ startA.size() - 1 ].GetCount() ,
|
||||
endB[ endB.size() - 1 ].GetCount() );
|
||||
G4int prevA = -1;
|
||||
@@ -211,14 +210,14 @@ G4LocatorChangeRecord::ReportEndChanges (
|
||||
if( advanceA )
|
||||
{
|
||||
++itrecA;
|
||||
if( !isLastA ) { ++jA; eventA = (*itrecA).GetCount(); }
|
||||
if( !isLastA ) { eventA = (*itrecA).GetCount(); }
|
||||
else { eventA = maxEvent; }
|
||||
}
|
||||
|
||||
if( advanceB )
|
||||
{
|
||||
++itrecB;
|
||||
if( !isLastB ) { ++jB; eventB = (*itrecB).GetCount(); }
|
||||
if( !isLastB ) { eventB = (*itrecB).GetCount(); }
|
||||
else { eventB = maxEvent; }
|
||||
}
|
||||
|
||||
@@ -258,7 +257,7 @@ std::ostream& operator<< ( std::ostream& os, const G4LocatorChangeRecord& e )
|
||||
//
|
||||
std::ostream& G4LocatorChangeRecord::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << " count = " << fEventCount
|
||||
<< " iter= " << fIteration
|
||||
<< " Location code = " << fCodeLocation
|
||||
|
||||
@@ -253,21 +253,44 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
|
||||
do // Loop checking, 07.10.2016, J.Apostolakis
|
||||
{ // REPEAT param
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( CurrentA_PointVelocity.GetCurveLength() >=
|
||||
CurrentB_PointVelocity.GetCurveLength() )
|
||||
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
|
||||
G4ThreeVector Point_B = CurrentB_PointVelocity.GetPosition();
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
const G4double lenA = CurrentA_PointVelocity.GetCurveLength() ;
|
||||
const G4double lenB = CurrentB_PointVelocity.GetCurveLength() ;
|
||||
G4double curv_lenAB = lenB - lenA;
|
||||
G4double distAB = (Point_B - Point_A).mag();
|
||||
if( curv_lenAB < distAB * ( 1. - 10.*fiEpsilonStep ) )
|
||||
{
|
||||
G4cerr << "ERROR> (Start) Point A coincides with or has gone past (end) point B"
|
||||
<< "MLL: iters = " << substep_no << G4endl;
|
||||
// G4LocatorChangeRecord::ReportVector(G4cerr, "endPointB", endChangeB );
|
||||
// G4cerr<<"EndPoints A(start) and B(end): combined changes " << G4endl;
|
||||
G4LocatorChangeLogger::ReportEndChanges(G4cerr, endChangeA, endChangeB);
|
||||
G4long op=G4cerr.precision(6);
|
||||
G4cerr << " Difference = " << distAB - curv_lenAB
|
||||
<< " exceeds limit of relative dist (10*epsilon)= " << 10*fiEpsilonStep
|
||||
<< " i.e. limit = " << 10 * fiEpsilonStep * distAB << G4endl;
|
||||
G4cerr.precision(9);
|
||||
G4cerr << " Len A, B = " << lenA << " " << lenB << G4endl
|
||||
<< " Position A: " << Point_A << G4endl
|
||||
<< " Position B: " << Point_B << G4endl;
|
||||
G4cerr.precision(op);
|
||||
// G4LocatorChangeRecord::ReportVector(G4cerr, "endPointB", endChangeB );
|
||||
// G4cerr<<"EndPoints A(start) and B(end): combined changes " << G4endl;
|
||||
if (fCheckMode) {
|
||||
G4LocatorChangeLogger::ReportEndChanges(G4cerr, endChangeA, endChangeB);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
|
||||
G4ThreeVector Point_B = CurrentB_PointVelocity.GetPosition();
|
||||
|
||||
if( !validIntersectP ){
|
||||
G4ExceptionDescription errmsg;
|
||||
errmsg << "Assertion FAILURE - invalid (stale) Interection point. Substep: "
|
||||
<< substep_no << " call: " << fNumCalls << G4endl;
|
||||
if (fCheckMode)
|
||||
G4LocatorChangeRecord::ReportEndChanges(errmsg, endChangeA, endChangeB );
|
||||
G4Exception("G4MultiLevelLocator::EstimateIntersectionPoint", "GeomNav0004",
|
||||
JustWarning, errmsg);
|
||||
}
|
||||
|
||||
// F = a point on true AB path close to point E
|
||||
// (the closest if possible)
|
||||
//
|
||||
@@ -282,26 +305,25 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
recApproxPoint.push_back(G4LocatorChangeRecord(G4LocatorChangeRecord::kInvalidCL,
|
||||
substep_no, eventCount, ApproxIntersecPointV ) );
|
||||
G4double lenIntsc= ApproxIntersecPointV.GetCurveLength();
|
||||
G4double lenB = CurrentB_PointVelocity.GetCurveLength();
|
||||
G4double checkVsEnd= lenB - lenIntsc;
|
||||
|
||||
if( lenIntsc > lenB )
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg.precision(17);
|
||||
G4double ratio = checkVsEnd / lenB;
|
||||
G4double ratioTol = std::fabs(ratio) / tolerance;
|
||||
errmsg << "Intermediate F point is past end B point" << G4endl
|
||||
<< " l( intersection ) = " << lenIntsc << G4endl
|
||||
<< " l( endpoint ) = " << lenB << G4endl;
|
||||
errmsg.precision(8);
|
||||
errmsg << " l_end - l_inters = " << checkVsEnd << G4endl
|
||||
<< " / l_end = " << ratio << G4endl
|
||||
<< " ratio / tolerance = " << ratioTol << G4endl;
|
||||
if( ratioTol < 1.0 )
|
||||
G4Exception(MethodName, "GeomNav0003", JustWarning, errmsg );
|
||||
else
|
||||
G4Exception(MethodName, "GeomNav0003", FatalException, errmsg );
|
||||
std::ostringstream errmsg;
|
||||
errmsg.precision(17);
|
||||
G4double ratio = checkVsEnd / lenB;
|
||||
G4double ratioTol = std::fabs(ratio) / tolerance;
|
||||
errmsg << "Intermediate F point is past end B point" << G4endl
|
||||
<< " l( intersection ) = " << lenIntsc << G4endl
|
||||
<< " l( endpoint ) = " << lenB << G4endl;
|
||||
errmsg.precision(8);
|
||||
errmsg << " l_end - l_inters = " << checkVsEnd << G4endl
|
||||
<< " / l_end = " << ratio << G4endl
|
||||
<< " ratio / tolerance = " << ratioTol << G4endl;
|
||||
if( ratioTol < 1.0 )
|
||||
G4Exception(MethodName, "GeomNav0003", JustWarning, errmsg );
|
||||
else
|
||||
G4Exception(MethodName, "GeomNav0003", FatalException, errmsg );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -476,6 +498,7 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
}
|
||||
else // not Intersects_FB
|
||||
{
|
||||
validIntersectP = false; // Intersections are now stale
|
||||
if( fin_section_depth[depth] )
|
||||
{
|
||||
// If B is the original endpoint, this means that whatever
|
||||
@@ -560,11 +583,6 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
// [ Implementation: a counter for # of recomputations
|
||||
// => avoids extra work]
|
||||
}
|
||||
// else
|
||||
// Move forward the other points
|
||||
// - or better flag it, so that they are re-computed when next used
|
||||
// [ Implementation: a counter for # of recomputations
|
||||
// => avoids extra work]
|
||||
if (fCheckMode)
|
||||
{
|
||||
++eventCount;
|
||||
@@ -578,23 +596,29 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
if( CurrentB_PointVelocity.GetCurveLength() < CurrentA_PointVelocity.GetCurveLength() )
|
||||
errorEndPt = 2;
|
||||
}
|
||||
|
||||
|
||||
if( errorEndPt > 1 ) // errorEndPt = 1 is milder, just: len(B)=len(A)
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
ReportReversedPoints(errmsg,
|
||||
CurveStartPointVelocity, CurveEndPointVelocity,
|
||||
NewSafety, fiEpsilonStep,
|
||||
CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
SubStart_PointVelocity, CurrentE_Point,
|
||||
ApproxIntersecPointV, substep_no, substep_no_p, depth);
|
||||
errmsg << G4endl << " * Location: " << MethodName
|
||||
<< "- After EndIf(Intersects_AF)" << G4endl;
|
||||
errmsg << " * Bool flags: Recalculated = " << recalculatedB
|
||||
<< " Intersects_AF = " << Intersects_AF
|
||||
<< " Intersects_FB = " << Intersects_FB << G4endl;
|
||||
errmsg << " * Number of calls to MLL:EIP= " << fNumCalls << G4endl;
|
||||
G4Exception(MethodName, "GeomNav0003", FatalException, errmsg);
|
||||
std::ostringstream errmsg;
|
||||
|
||||
ReportReversedPoints(errmsg,
|
||||
CurveStartPointVelocity, CurveEndPointVelocity,
|
||||
NewSafety, fiEpsilonStep,
|
||||
CurrentA_PointVelocity, CurrentB_PointVelocity,
|
||||
SubStart_PointVelocity, CurrentE_Point,
|
||||
ApproxIntersecPointV, substep_no, substep_no_p, depth);
|
||||
|
||||
if (fCheckMode) {
|
||||
G4LocatorChangeRecord::ReportEndChanges(errmsg, endChangeA, endChangeB );
|
||||
}
|
||||
|
||||
errmsg << G4endl << " * Location: " << MethodName
|
||||
<< "- After EndIf(Intersects_AF)" << G4endl;
|
||||
errmsg << " * Bool flags: Recalculated = " << recalculatedB
|
||||
<< " Intersects_AF = " << Intersects_AF
|
||||
<< " Intersects_FB = " << Intersects_FB << G4endl;
|
||||
errmsg << " * Number of calls to MLL:EIP= " << fNumCalls << G4endl;
|
||||
G4Exception(MethodName, "GeomNav0003", FatalException, errmsg);
|
||||
}
|
||||
if( restoredFullEndpoint )
|
||||
{
|
||||
@@ -619,10 +643,12 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
G4cout << " Start: ";
|
||||
printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
|
||||
-1.0, NewSafety, 0 );
|
||||
|
||||
G4cout << " ** Change records: " << G4endl;
|
||||
G4cout << "endPoints A (start) and B (end): combined changes of AB intervals" << G4endl;
|
||||
G4LocatorChangeRecord::ReportEndChanges(G4cout, endChangeA, endChangeB );
|
||||
if( fCheckMode ) {
|
||||
G4LocatorChangeRecord::ReportEndChanges(G4cout, endChangeA, endChangeB );
|
||||
} else {
|
||||
G4cout << " ** For more information enable 'check mode' in G4MultiLevelLocator "
|
||||
<< "-- (it saves and can output change records) " << G4endl;
|
||||
}
|
||||
}
|
||||
G4cout << " Point A: ";
|
||||
printStatus( CurrentA_PointVelocity, CurrentA_PointVelocity,
|
||||
@@ -637,6 +663,7 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
|
||||
} while ( ( ! found_approximate_intersection )
|
||||
&& ( ! there_is_no_intersection )
|
||||
&& validIntersectP // New condition: must refresh intersection !!
|
||||
&& ( substep_no_p <= param_substeps) ); // UNTIL found or
|
||||
// failed param substep
|
||||
|
||||
@@ -761,16 +788,12 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
}
|
||||
} // if did_len
|
||||
|
||||
unsigned int levelPops = 0;
|
||||
|
||||
G4bool unfinished = Second_half;
|
||||
while ( unfinished && (depth>0) ) // Loop checking, 07.10.2016, JA
|
||||
{
|
||||
// Second part of curve (InterMed[depth],Intermed[depth-1]))
|
||||
// On the depth-1 level normally we are on the 'second_half'
|
||||
|
||||
++levelPops;
|
||||
|
||||
// Find new trial intersection point needed at start of the loop
|
||||
//
|
||||
SubStart_PointVelocity = *ptrInterMedFT[depth];
|
||||
@@ -878,7 +901,6 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
|
||||
G4cout << "MLL - WARNING Potential FAILURE: Conditions not met!"
|
||||
<< G4endl
|
||||
<< " Depth = " << depth << G4endl
|
||||
<< " Levels popped = " << levelPops
|
||||
<< " Num Substeps= " << substep_no << G4endl;
|
||||
G4cout << " Found intersection= " << found_approximate_intersection
|
||||
<< G4endl;
|
||||
|
||||
@@ -250,8 +250,8 @@ void G4MultiNavigator::PrepareNavigators()
|
||||
|
||||
// Message the transportation-manager to find active navigators
|
||||
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
fNoActiveNavigators= pTransportManager-> GetNoActiveNavigators();
|
||||
std::vector<G4Navigator*>::const_iterator pNavigatorIter;
|
||||
fNoActiveNavigators = (G4int)pTransportManager-> GetNoActiveNavigators();
|
||||
|
||||
if( fNoActiveNavigators > fMaxNav )
|
||||
{
|
||||
@@ -560,7 +560,7 @@ G4MultiNavigator::PrintLimited()
|
||||
{
|
||||
stepLen = fTrueMinStep; // did not limit (went as far as asked)
|
||||
}
|
||||
G4int oldPrec = G4cout.precision(9);
|
||||
G4long oldPrec = G4cout.precision(9);
|
||||
|
||||
G4cout << std::setw(5) << num << " "
|
||||
<< std::setw(12) << stepLen << " "
|
||||
|
||||
@@ -109,7 +109,7 @@ G4NavigationLogger::PreComputeStepLog(const G4VPhysicalVolume* motherPhysical,
|
||||
if ( fVerbose > 1 )
|
||||
{
|
||||
static const G4int precVerf = 16; // Precision
|
||||
G4int oldprec = G4cout.precision(precVerf);
|
||||
G4long oldprec = G4cout.precision(precVerf);
|
||||
G4cout << " - Information on mother / key daughters ..." << G4endl;
|
||||
G4cout << " Type " << std::setw(12) << "Solid-Name" << " "
|
||||
<< std::setw(3*(6+precVerf)) << " local point" << " "
|
||||
@@ -236,7 +236,7 @@ G4NavigationLogger::AlongComputeStepLog(const G4VSolid* sampleSolid,
|
||||
if ( fVerbose > 1 )
|
||||
{
|
||||
static const G4int precVerf= 20; // Precision
|
||||
G4int oldprec = G4cout.precision(precVerf);
|
||||
G4long oldprec = G4cout.precision(precVerf);
|
||||
G4cout << "Daughter "
|
||||
<< std::setw(12) << sampleSolid->GetName() << " "
|
||||
<< std::setw(4+precVerf) << samplePoint << " "
|
||||
@@ -451,8 +451,8 @@ G4NavigationLogger::PostComputeStepLog(const G4VSolid* motherSolid,
|
||||
if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) )
|
||||
{
|
||||
G4String fType = fId + "::ComputeStep()";
|
||||
G4int oldPrOut = G4cout.precision(16);
|
||||
G4int oldPrErr = G4cerr.precision(16);
|
||||
G4long oldPrOut = G4cout.precision(16);
|
||||
G4long oldPrErr = G4cerr.precision(16);
|
||||
std::ostringstream message;
|
||||
message << "Current point is outside the current solid !" << G4endl
|
||||
<< " Problem in Navigation" << G4endl
|
||||
@@ -468,7 +468,7 @@ G4NavigationLogger::PostComputeStepLog(const G4VSolid* motherSolid,
|
||||
if ( fVerbose > 1 )
|
||||
{
|
||||
static const G4int precVerf = 20; // Precision
|
||||
G4int oldprec = G4cout.precision(precVerf);
|
||||
G4long oldprec = G4cout.precision(precVerf);
|
||||
G4cout << " Mother " << std::setw(12) << motherSolid->GetName() << " "
|
||||
<< std::setw(4+precVerf) << localPoint << " "
|
||||
<< std::setw(4+precVerf) << motherSafety << " "
|
||||
@@ -526,7 +526,7 @@ G4NavigationLogger::PrintDaughterLog (const G4VSolid* sampleSolid,
|
||||
{
|
||||
if ( fVerbose >= 1 )
|
||||
{
|
||||
G4int oldPrec = G4cout.precision(8);
|
||||
G4long oldPrec = G4cout.precision(8);
|
||||
G4cout << "Daughter "
|
||||
<< std::setw(15) << sampleSafety << " ";
|
||||
if (withStep) // (sampleStep != -1.0 )
|
||||
|
||||
@@ -154,7 +154,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 2 )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
G4long oldcoutPrec = G4cout.precision(8);
|
||||
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup: ***" << G4endl;
|
||||
G4cout << " Called with arguments: " << G4endl
|
||||
<< " Globalpoint = " << globalPoint << G4endl
|
||||
@@ -169,7 +169,6 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
#endif
|
||||
|
||||
G4int noLevelsExited = 0;
|
||||
G4int noLevelsEntered = 0;
|
||||
|
||||
if ( !relativeSearch )
|
||||
{
|
||||
@@ -222,10 +221,6 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
else
|
||||
if ( fEntering )
|
||||
{
|
||||
// assert( fBlockedPhysicalVolume!=0 );
|
||||
|
||||
++noLevelsEntered; // count the first level entered too
|
||||
|
||||
switch (VolumeType(fBlockedPhysicalVolume))
|
||||
{
|
||||
case kNormal:
|
||||
@@ -524,8 +519,6 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
|
||||
if ( noResult )
|
||||
{
|
||||
++noLevelsEntered;
|
||||
|
||||
// Entering a daughter after ascending
|
||||
//
|
||||
// The blocked volume is no longer valid - it was for another level
|
||||
@@ -570,7 +563,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose >= 4 )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
G4long oldcoutPrec = G4cout.precision(8);
|
||||
G4String curPhysVol_Name("None");
|
||||
if (targetPhysical) { curPhysVol_Name = targetPhysical->GetName(); }
|
||||
G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl;
|
||||
@@ -1180,7 +1173,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector& pGlobalpoint,
|
||||
//
|
||||
if( fValidExitNormal || fCalculatedExitNormal )
|
||||
{
|
||||
G4int depth = fHistory.GetDepth();
|
||||
G4int depth = (G4int)fHistory.GetDepth();
|
||||
if( depth > 0 )
|
||||
{
|
||||
fExitNormalGlobalFrame = fHistory.GetTransform(depth-1)
|
||||
@@ -1311,7 +1304,7 @@ void G4Navigator::ResetState()
|
||||
//
|
||||
void G4Navigator::SetupHierarchy()
|
||||
{
|
||||
const G4int depth = fHistory.GetDepth();
|
||||
const G4int depth = (G4int)fHistory.GetDepth();
|
||||
for ( auto i = 1; i <= depth; ++i )
|
||||
{
|
||||
switch ( fHistory.GetVolumeType(i) )
|
||||
@@ -1943,7 +1936,7 @@ G4TouchableHistoryHandle G4Navigator::CreateTouchableHistoryHandle() const
|
||||
//
|
||||
void G4Navigator::PrintState() const
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(4);
|
||||
G4long oldcoutPrec = G4cout.precision(4);
|
||||
if( fVerbose >= 4 )
|
||||
{
|
||||
G4cout << "The current state of G4Navigator is: " << G4endl;
|
||||
@@ -2031,8 +2024,8 @@ void G4Navigator::ComputeStepLog(const G4ThreeVector& pGlobalpoint,
|
||||
|
||||
if( diffShiftSaf > fAccuracyForWarning )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(8);
|
||||
G4int oldcerrPrec = G4cerr.precision(10);
|
||||
G4long oldcoutPrec = G4cout.precision(8);
|
||||
G4long oldcerrPrec = G4cerr.precision(10);
|
||||
std::ostringstream message, suggestion;
|
||||
message << "Accuracy error or slightly inaccurate position shift."
|
||||
<< G4endl
|
||||
@@ -2142,7 +2135,7 @@ std::ostream& operator << (std::ostream &os,const G4Navigator &n)
|
||||
|
||||
// Adapted from G4Navigator::PrintState() const
|
||||
|
||||
G4int oldcoutPrec = os.precision(4);
|
||||
G4long oldcoutPrec = os.precision(4);
|
||||
if( n.fVerbose >= 4 )
|
||||
{
|
||||
os << "The current state of G4Navigator is: " << G4endl;
|
||||
|
||||
@@ -80,7 +80,7 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector& localPoint,
|
||||
G4ThreeVector sampleDirection;
|
||||
G4double ourStep = currentProposedStepLength, ourSafety;
|
||||
G4double motherSafety, motherStep = DBL_MAX;
|
||||
G4int localNoDaughters, sampleNo;
|
||||
G4long localNoDaughters, sampleNo;
|
||||
G4bool motherValidExitNormal = false;
|
||||
G4ThreeVector motherExitNormal;
|
||||
|
||||
@@ -337,7 +337,7 @@ G4double G4NormalNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
G4LogicalVolume *motherLogical;
|
||||
G4VSolid *motherSolid;
|
||||
G4double motherSafety, ourSafety;
|
||||
G4int localNoDaughters, sampleNo;
|
||||
G4long localNoDaughters, sampleNo;
|
||||
|
||||
motherPhysical = history.GetTopVolume();
|
||||
motherLogical = motherPhysical->GetLogicalVolume();
|
||||
|
||||
@@ -96,7 +96,7 @@ G4double G4ParameterisedNavigation::
|
||||
|
||||
G4bool initialNode, noStep;
|
||||
G4SmartVoxelNode *curVoxelNode;
|
||||
G4int curNoVolumes, contentNo;
|
||||
G4long curNoVolumes, contentNo;
|
||||
G4double voxelSafety;
|
||||
|
||||
// Replication data
|
||||
@@ -227,7 +227,7 @@ G4double G4ParameterisedNavigation::
|
||||
|
||||
for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
|
||||
{
|
||||
sampleNo = curVoxelNode->GetVolume(contentNo);
|
||||
sampleNo = curVoxelNode->GetVolume((G4int)contentNo);
|
||||
if ( !fBList.IsBlocked(sampleNo) )
|
||||
{
|
||||
fBList.BlockVolume(sampleNo);
|
||||
@@ -270,7 +270,7 @@ G4double G4ParameterisedNavigation::
|
||||
EInside insideIntPt = sampleSolid->Inside(intersectionPoint);
|
||||
if( insideIntPt != kSurface )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(16);
|
||||
G4long oldcoutPrec = G4cout.precision(16);
|
||||
std::ostringstream message;
|
||||
message << "Navigator gets conflicting response from Solid."
|
||||
<< G4endl
|
||||
@@ -405,7 +405,7 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
G4int sampleNo, curVoxelNodeNo;
|
||||
|
||||
G4SmartVoxelNode *curVoxelNode;
|
||||
G4int curNoVolumes, contentNo;
|
||||
G4long curNoVolumes, contentNo;
|
||||
G4double voxelSafety;
|
||||
|
||||
// Replication data
|
||||
@@ -456,7 +456,7 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
|
||||
for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
|
||||
{
|
||||
sampleNo = curVoxelNode->GetVolume(contentNo);
|
||||
sampleNo = curVoxelNode->GetVolume((G4int)contentNo);
|
||||
|
||||
// Call virtual methods, and copy information if needed
|
||||
//
|
||||
@@ -503,7 +503,7 @@ ComputeVoxelSafety(const G4ThreeVector& localPoint,
|
||||
|
||||
G4double voxelSafety, plusVoxelSafety, minusVoxelSafety;
|
||||
G4double curNodeOffset, minCurCommonDelta, maxCurCommonDelta;
|
||||
G4int minCurNodeNoDelta, maxCurNodeNoDelta;
|
||||
G4long minCurNodeNoDelta, maxCurNodeNoDelta;
|
||||
|
||||
// Compute linear intersection distance to boundaries of max/min
|
||||
// to collected nodes at current level
|
||||
@@ -624,7 +624,7 @@ G4ParameterisedNavigation::LevelLocate( G4NavigationHistory& history,
|
||||
//
|
||||
motherVoxelNode = ParamVoxelLocate(motherVoxelHeader,localPoint);
|
||||
|
||||
voxelNoDaughters = motherVoxelNode->GetNoContained();
|
||||
voxelNoDaughters = (G4int)motherVoxelNode->GetNoContained();
|
||||
if ( voxelNoDaughters==0 ) { return false; }
|
||||
|
||||
pPhysical = motherLogical->GetDaughter(0);
|
||||
|
||||
@@ -69,7 +69,7 @@ GetTranslation(const G4int copyNo ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
|
||||
size_t nx, ny, nz;
|
||||
std::size_t nx, ny, nz;
|
||||
ComputeVoxelIndices( copyNo, nx, ny, nz );
|
||||
|
||||
G4ThreeVector trans( (2*nx+1)*fVoxelHalfX - fContainerWallX,
|
||||
@@ -92,7 +92,7 @@ ComputeMaterial( const G4int copyNo, G4VPhysicalVolume*, const G4VTouchable* )
|
||||
|
||||
//------------------------------------------------------------------
|
||||
size_t G4PartialPhantomParameterisation::
|
||||
GetMaterialIndex( size_t copyNo ) const
|
||||
GetMaterialIndex( std::size_t copyNo ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
|
||||
@@ -104,16 +104,16 @@ GetMaterialIndex( size_t copyNo ) const
|
||||
|
||||
//------------------------------------------------------------------
|
||||
size_t G4PartialPhantomParameterisation::
|
||||
GetMaterialIndex( size_t nx, size_t ny, size_t nz ) const
|
||||
GetMaterialIndex( std::size_t nx, std::size_t ny, std::size_t nz ) const
|
||||
{
|
||||
size_t copyNo = nx + fNoVoxelsX*ny + fNoVoxelsXY*nz;
|
||||
std::size_t copyNo = nx + fNoVoxelsX*ny + fNoVoxelsXY*nz;
|
||||
return GetMaterialIndex( copyNo );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4Material* G4PartialPhantomParameterisation::
|
||||
GetMaterial( size_t nx, size_t ny, size_t nz) const
|
||||
GetMaterial( std::size_t nx, std::size_t ny, std::size_t nz) const
|
||||
{
|
||||
return fMaterials[GetMaterialIndex(nx,ny,nz)];
|
||||
}
|
||||
@@ -121,7 +121,7 @@ GetMaterial( size_t nx, size_t ny, size_t nz) const
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4Material* G4PartialPhantomParameterisation::
|
||||
GetMaterial( size_t copyNo ) const
|
||||
GetMaterial( std::size_t copyNo ) const
|
||||
{
|
||||
return fMaterials[GetMaterialIndex(copyNo)];
|
||||
}
|
||||
@@ -129,15 +129,15 @@ GetMaterial( size_t copyNo ) const
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PartialPhantomParameterisation::
|
||||
ComputeVoxelIndices(const G4int copyNo, size_t& nx,
|
||||
size_t& ny, size_t& nz ) const
|
||||
ComputeVoxelIndices(const G4int copyNo, std::size_t& nx,
|
||||
std::size_t& ny, std::size_t& nz ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
|
||||
auto ite = fFilledIDs.lower_bound(size_t(copyNo));
|
||||
G4int dist = std::distance( fFilledIDs.cbegin(), ite );
|
||||
nz = size_t( dist/fNoVoxelsY );
|
||||
ny = size_t( dist%fNoVoxelsY );
|
||||
auto ite = fFilledIDs.lower_bound(copyNo);
|
||||
G4long dist = std::distance( fFilledIDs.cbegin(), ite );
|
||||
nz = std::size_t( dist/fNoVoxelsY );
|
||||
ny = std::size_t( dist%fNoVoxelsY );
|
||||
|
||||
G4int ifmin = (*ite).second;
|
||||
G4int nvoxXprev;
|
||||
@@ -249,7 +249,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
}
|
||||
else if( nx >= G4int(fNoVoxelsX) )
|
||||
{
|
||||
nx = fNoVoxelsX-1;
|
||||
nx = G4int(fNoVoxelsX)-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( ny < 0 )
|
||||
@@ -259,7 +259,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
}
|
||||
else if( ny >= G4int(fNoVoxelsY) )
|
||||
{
|
||||
ny = fNoVoxelsY-1;
|
||||
ny = G4int(fNoVoxelsY)-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( nz < 0 )
|
||||
@@ -269,7 +269,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
}
|
||||
else if( nz >= G4int(fNoVoxelsZ) )
|
||||
{
|
||||
nz = fNoVoxelsZ-1;
|
||||
nz = G4int(fNoVoxelsZ)-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( !isOK )
|
||||
@@ -289,7 +289,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
"GeomNav1002", JustWarning, message);
|
||||
}
|
||||
|
||||
G4int nyz = nz*fNoVoxelsY+ny;
|
||||
G4int nyz = G4int(nz*fNoVoxelsY+ny);
|
||||
auto ite = fFilledIDs.cbegin();
|
||||
/*
|
||||
for( ite = fFilledIDs.cbegin(); ite != fFilledIDs.cend(); ++ite )
|
||||
@@ -316,7 +316,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PartialPhantomParameterisation::CheckCopyNo( const G4int copyNo ) const
|
||||
void G4PartialPhantomParameterisation::CheckCopyNo( const G4long copyNo ) const
|
||||
{
|
||||
if( copyNo < 0 || copyNo >= G4int(fNoVoxels) )
|
||||
{
|
||||
|
||||
@@ -364,7 +364,7 @@ G4PathFinder::PrepareNewTrack( const G4ThreeVector& position,
|
||||
//
|
||||
std::vector<G4Navigator*>::iterator pNavigatorIter;
|
||||
|
||||
fNoActiveNavigators = fpTransportManager-> GetNoActiveNavigators();
|
||||
fNoActiveNavigators = (G4int)fpTransportManager-> GetNoActiveNavigators();
|
||||
if( fNoActiveNavigators > fMaxNav )
|
||||
{
|
||||
std::ostringstream message;
|
||||
@@ -1110,7 +1110,7 @@ void G4PathFinder::PrintLimited()
|
||||
{
|
||||
stepLen = fTrueMinStep; // did not limit (went as far as asked)
|
||||
}
|
||||
G4int oldPrec = G4cout.precision(9);
|
||||
G4long oldPrec = G4cout.precision(9);
|
||||
|
||||
G4cout << std::setw(5) << fCurrentStepNo << " "
|
||||
<< std::setw(5) << num << " "
|
||||
|
||||
@@ -94,9 +94,9 @@ GetTranslation(const G4int copyNo ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
|
||||
size_t nx;
|
||||
size_t ny;
|
||||
size_t nz;
|
||||
std::size_t nx;
|
||||
std::size_t ny;
|
||||
std::size_t nz;
|
||||
|
||||
ComputeVoxelIndices( copyNo, nx, ny, nz );
|
||||
|
||||
@@ -120,15 +120,15 @@ G4Material* G4PhantomParameterisation::
|
||||
ComputeMaterial(const G4int copyNo, G4VPhysicalVolume *, const G4VTouchable *)
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
size_t matIndex = GetMaterialIndex(copyNo);
|
||||
std::size_t matIndex = GetMaterialIndex(copyNo);
|
||||
|
||||
return fMaterials[ matIndex ];
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
size_t G4PhantomParameterisation::
|
||||
GetMaterialIndex( size_t copyNo ) const
|
||||
std::size_t G4PhantomParameterisation::
|
||||
GetMaterialIndex( std::size_t copyNo ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
|
||||
@@ -138,36 +138,38 @@ GetMaterialIndex( size_t copyNo ) const
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
size_t G4PhantomParameterisation::
|
||||
GetMaterialIndex( size_t nx, size_t ny, size_t nz ) const
|
||||
std::size_t G4PhantomParameterisation::
|
||||
GetMaterialIndex( std::size_t nx, std::size_t ny, std::size_t nz ) const
|
||||
{
|
||||
size_t copyNo = nx + fNoVoxelsX*ny + fNoVoxelsXY*nz;
|
||||
std::size_t copyNo = nx + fNoVoxelsX*ny + fNoVoxelsXY*nz;
|
||||
return GetMaterialIndex( copyNo );
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4Material*
|
||||
G4PhantomParameterisation::GetMaterial( size_t nx, size_t ny, size_t nz) const
|
||||
G4PhantomParameterisation::GetMaterial( std::size_t nx, std::size_t ny, std::size_t nz) const
|
||||
{
|
||||
return fMaterials[GetMaterialIndex(nx,ny,nz)];
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
G4Material* G4PhantomParameterisation::GetMaterial( size_t copyNo ) const
|
||||
G4Material* G4PhantomParameterisation::GetMaterial( std::size_t copyNo ) const
|
||||
{
|
||||
return fMaterials[GetMaterialIndex(copyNo)];
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PhantomParameterisation::
|
||||
ComputeVoxelIndices(const G4int copyNo, size_t& nx,
|
||||
size_t& ny, size_t& nz ) const
|
||||
ComputeVoxelIndices(const G4int copyNo, std::size_t& nx,
|
||||
std::size_t& ny, std::size_t& nz ) const
|
||||
{
|
||||
CheckCopyNo( copyNo );
|
||||
nx = size_t(copyNo%fNoVoxelsX);
|
||||
ny = size_t( (copyNo/fNoVoxelsX)%fNoVoxelsY );
|
||||
nz = size_t(copyNo/fNoVoxelsXY);
|
||||
nx = std::size_t(copyNo%fNoVoxelsX);
|
||||
ny = std::size_t( (copyNo/fNoVoxelsX)%fNoVoxelsY );
|
||||
nz = std::size_t(copyNo/fNoVoxelsXY);
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +327,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
}
|
||||
}
|
||||
|
||||
G4int copyNo = nx + fNoVoxelsX*ny + fNoVoxelsXY*nz;
|
||||
G4int copyNo = G4int(nx + fNoVoxelsX*ny + fNoVoxelsXY*nz);
|
||||
|
||||
// Check if there are still errors
|
||||
//
|
||||
@@ -337,7 +339,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
}
|
||||
else if( nx >= G4int(fNoVoxelsX) )
|
||||
{
|
||||
nx = fNoVoxelsX-1;
|
||||
nx = G4int(fNoVoxelsX)-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( ny < 0 )
|
||||
@@ -347,7 +349,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
}
|
||||
else if( ny >= G4int(fNoVoxelsY) )
|
||||
{
|
||||
ny = fNoVoxelsY-1;
|
||||
ny = G4int(fNoVoxelsY)-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( nz < 0 )
|
||||
@@ -357,7 +359,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
}
|
||||
else if( nz >= G4int(fNoVoxelsZ) )
|
||||
{
|
||||
nz = fNoVoxelsZ-1;
|
||||
nz = G4int(fNoVoxelsZ)-1;
|
||||
isOK = false;
|
||||
}
|
||||
if( !isOK )
|
||||
@@ -379,7 +381,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
"GeomNav1002", JustWarning, message);
|
||||
}
|
||||
|
||||
copyNo = nx + fNoVoxelsX*ny + fNoVoxelsXY*nz;
|
||||
copyNo = G4int(nx + fNoVoxelsX*ny + fNoVoxelsXY*nz);
|
||||
}
|
||||
|
||||
return copyNo;
|
||||
@@ -387,7 +389,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void G4PhantomParameterisation::CheckCopyNo( const G4int copyNo ) const
|
||||
void G4PhantomParameterisation::CheckCopyNo( const G4long copyNo ) const
|
||||
{
|
||||
if( copyNo < 0 || copyNo >= G4int(fNoVoxels) )
|
||||
{
|
||||
|
||||
@@ -536,7 +536,7 @@ G4PropagatorInField::printStatus( const G4FieldTrack& StartFT,
|
||||
|
||||
G4double step_len = CurrentFT.GetCurveLength() - StartFT.GetCurveLength();
|
||||
|
||||
G4int oldprec; // cout/cerr precision settings
|
||||
G4long oldprec; // cout/cerr precision settings
|
||||
|
||||
if( ((stepNo == 0) && (verboseLevel <3)) || (verboseLevel >= 3) )
|
||||
{
|
||||
@@ -617,7 +617,7 @@ G4PropagatorInField::PrintStepLengthDiagnostic(
|
||||
G4double stepTrial,
|
||||
const G4FieldTrack& )
|
||||
{
|
||||
G4int iprec= G4cout.precision(8);
|
||||
G4long iprec= G4cout.precision(8);
|
||||
G4cout << " " << std::setw(12) << " PiF: NoZeroStep "
|
||||
<< " " << std::setw(20) << " CurrentProposed len "
|
||||
<< " " << std::setw(18) << " Full_curvelen_last"
|
||||
|
||||
@@ -156,7 +156,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
|
||||
// To get replica No: transform local point to the reference system of the
|
||||
// param container volume
|
||||
//
|
||||
G4int ide = history.GetDepth();
|
||||
G4int ide = (G4int)history.GetDepth();
|
||||
G4ThreeVector containerPoint = history.GetTransform(ide)
|
||||
.InverseTransformPoint(localPoint);
|
||||
|
||||
|
||||
@@ -770,7 +770,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
|
||||
G4double ourStep=currentProposedStepLength;
|
||||
G4double ourSafety=kInfinity;
|
||||
G4double sampleStep, sampleSafety, motherStep, motherSafety;
|
||||
G4int localNoDaughters, sampleNo;
|
||||
G4long localNoDaughters, sampleNo;
|
||||
G4int depth;
|
||||
G4ExitNormal exitNormalStc;
|
||||
// G4int depthDeterminingStep= -1; // Useful only for debugging - for now
|
||||
@@ -803,7 +803,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
|
||||
history.GetTopReplicaNo(),
|
||||
localPoint);
|
||||
G4ExitNormal normalOutStc;
|
||||
const G4int topDepth= history.GetDepth();
|
||||
const G4int topDepth= (G4int)history.GetDepth();
|
||||
|
||||
ourSafety = std::min( ourSafety, sampleSafety);
|
||||
|
||||
@@ -1034,7 +1034,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
|
||||
localNoDaughters = repLogical->GetNoDaughters();
|
||||
for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo-- )
|
||||
{
|
||||
samplePhysical = repLogical->GetDaughter(sampleNo);
|
||||
samplePhysical = repLogical->GetDaughter((G4int)sampleNo);
|
||||
if ( samplePhysical!=blockedExitedVol )
|
||||
{
|
||||
G4ThreeVector localExitNorm;
|
||||
@@ -1066,7 +1066,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
|
||||
entering = true;
|
||||
exiting = false;
|
||||
*pBlockedPhysical = samplePhysical;
|
||||
blockedReplicaNo = sampleNo;
|
||||
blockedReplicaNo = (G4int)sampleNo;
|
||||
|
||||
#ifdef DAUGHTER_NORMAL_ALSO
|
||||
// This norm can be calculated later, if needed daughter is available
|
||||
@@ -1086,7 +1086,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
|
||||
EInside insideIntPt = sampleSolid->Inside(intersectionPoint);
|
||||
if ( insideIntPt != kSurface )
|
||||
{
|
||||
G4int oldcoutPrec = G4cout.precision(16);
|
||||
G4long oldcoutPrec = G4cout.precision(16);
|
||||
std::ostringstream message;
|
||||
message << "Navigator gets conflicting response from Solid."
|
||||
<< G4endl
|
||||
@@ -1161,7 +1161,7 @@ G4ReplicaNavigation::ComputeSafety(const G4ThreeVector& globalPoint,
|
||||
G4ThreeVector repPoint;
|
||||
G4double ourSafety = kInfinity;
|
||||
G4double sampleSafety;
|
||||
G4int localNoDaughters, sampleNo;
|
||||
G4long localNoDaughters, sampleNo;
|
||||
G4int depth;
|
||||
|
||||
repPhysical = history.GetTopVolume();
|
||||
@@ -1179,7 +1179,7 @@ G4ReplicaNavigation::ComputeSafety(const G4ThreeVector& globalPoint,
|
||||
ourSafety = sampleSafety;
|
||||
}
|
||||
|
||||
depth = history.GetDepth()-1;
|
||||
depth = (G4int)history.GetDepth()-1;
|
||||
|
||||
// Loop checking, 07.10.2016, JA -- need to add: assert(depth>0)
|
||||
while ( history.GetVolumeType(depth)==kReplica )
|
||||
@@ -1212,7 +1212,7 @@ G4ReplicaNavigation::ComputeSafety(const G4ThreeVector& globalPoint,
|
||||
localNoDaughters = repLogical->GetNoDaughters();
|
||||
for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo-- )
|
||||
{
|
||||
samplePhysical = repLogical->GetDaughter(sampleNo);
|
||||
samplePhysical = repLogical->GetDaughter((G4int)sampleNo);
|
||||
if ( samplePhysical!=blockedExitedVol )
|
||||
{
|
||||
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
|
||||
@@ -1250,7 +1250,7 @@ G4ReplicaNavigation::BackLocate(G4NavigationHistory& history,
|
||||
G4int mdepth, depth, cdepth;
|
||||
EInside insideCode;
|
||||
|
||||
cdepth = history.GetDepth();
|
||||
cdepth = (G4int)history.GetDepth();
|
||||
|
||||
// Find non replicated mother
|
||||
//
|
||||
|
||||
@@ -103,7 +103,7 @@ G4VIntersectionLocator::printStatus( const G4FieldTrack& StartFT,
|
||||
const G4ThreeVector CurrentUnitVelocity = CurrentFT.GetMomentumDir();
|
||||
|
||||
G4double step_len = CurrentFT.GetCurveLength() - StartFT.GetCurveLength();
|
||||
G4int oldprc; // cout/cerr precision settings
|
||||
G4long oldprc; // cout/cerr precision settings
|
||||
|
||||
if( ((stepNo == 0) && (verboseLevel <3)) || (verboseLevel >= 3) )
|
||||
{
|
||||
@@ -789,7 +789,7 @@ ReportReversedPoints( std::ostringstream& msg,
|
||||
<< " Point B' (end) is " << B_PtVel << G4endl;
|
||||
msg << " fEpsStep= " << epsStep << G4endl << G4endl;
|
||||
|
||||
G4int oldprc = msg.precision(20);
|
||||
G4long oldprc = msg.precision(20);
|
||||
msg << " In full precision, the position, momentum, E_kin, length, rest mass "
|
||||
<< " ... are: " << G4endl;
|
||||
msg << " Point A[0] (Curve start) is " << StartPointVel << G4endl
|
||||
|
||||
@@ -107,7 +107,7 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
|
||||
|
||||
G4bool initialNode, noStep;
|
||||
G4SmartVoxelNode *curVoxelNode;
|
||||
G4int curNoVolumes, contentNo;
|
||||
G4long curNoVolumes, contentNo;
|
||||
G4double voxelSafety;
|
||||
|
||||
motherPhysical = history.GetTopVolume();
|
||||
@@ -164,7 +164,7 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
|
||||
}
|
||||
#endif
|
||||
|
||||
localNoDaughters = motherLogical->GetNoDaughters();
|
||||
localNoDaughters = (G4int)motherLogical->GetNoDaughters();
|
||||
|
||||
fBList.Enlarge(localNoDaughters);
|
||||
fBList.Reset();
|
||||
@@ -178,7 +178,7 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
|
||||
curNoVolumes = curVoxelNode->GetNoContained();
|
||||
for (contentNo=curNoVolumes-1; contentNo>=0; contentNo--)
|
||||
{
|
||||
sampleNo = curVoxelNode->GetVolume(contentNo);
|
||||
sampleNo = curVoxelNode->GetVolume((G4int)contentNo);
|
||||
if ( !fBList.IsBlocked(sampleNo) )
|
||||
{
|
||||
fBList.BlockVolume(sampleNo);
|
||||
@@ -601,7 +601,7 @@ G4VoxelNavigation::LocateNextVoxel(const G4ThreeVector& localPoint,
|
||||
++fVoxelDepth;
|
||||
newHeader = newProxy->GetHeader();
|
||||
newHeaderAxis = newHeader->GetAxis();
|
||||
newHeaderNoSlices = newHeader->GetNoSlices();
|
||||
newHeaderNoSlices = (G4int)newHeader->GetNoSlices();
|
||||
newHeaderMin = newHeader->GetMinExtent();
|
||||
newHeaderNodeWidth = (newHeader->GetMaxExtent()-newHeaderMin)
|
||||
/ newHeaderNoSlices;
|
||||
@@ -651,7 +651,7 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
G4double motherSafety, ourSafety;
|
||||
G4int sampleNo;
|
||||
G4SmartVoxelNode *curVoxelNode;
|
||||
G4int curNoVolumes, contentNo;
|
||||
G4long curNoVolumes, contentNo;
|
||||
G4double voxelSafety;
|
||||
|
||||
motherPhysical = history.GetTopVolume();
|
||||
@@ -731,7 +731,7 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
|
||||
for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
|
||||
{
|
||||
sampleNo = curVoxelNode->GetVolume(contentNo);
|
||||
sampleNo = curVoxelNode->GetVolume((G4int)contentNo);
|
||||
samplePhysical = motherLogical->GetDaughter(sampleNo);
|
||||
|
||||
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
|
||||
|
||||
@@ -135,7 +135,7 @@ G4VoxelSafety::ComputeSafety(const G4ThreeVector& localPoint,
|
||||
<< ", to be considered as 'mother safety'." << G4endl;
|
||||
}
|
||||
#endif
|
||||
localNoDaughters = motherLogical->GetNoDaughters();
|
||||
localNoDaughters = (G4int)motherLogical->GetNoDaughters();
|
||||
|
||||
fBlockList.Enlarge(localNoDaughters);
|
||||
fBlockList.Reset();
|
||||
@@ -160,7 +160,8 @@ G4VoxelSafety::SafetyForVoxelNode( const G4SmartVoxelNode* curVoxelNode,
|
||||
{
|
||||
G4double ourSafety = DBL_MAX;
|
||||
|
||||
G4int curNoVolumes, contentNo, sampleNo;
|
||||
G4long curNoVolumes, contentNo;
|
||||
G4int sampleNo;
|
||||
G4VPhysicalVolume* samplePhysical;
|
||||
|
||||
G4double sampleSafety = 0.0;
|
||||
@@ -171,7 +172,7 @@ G4VoxelSafety::SafetyForVoxelNode( const G4SmartVoxelNode* curVoxelNode,
|
||||
|
||||
for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
|
||||
{
|
||||
sampleNo = curVoxelNode->GetVolume(contentNo);
|
||||
sampleNo = curVoxelNode->GetVolume((G4int)contentNo);
|
||||
if ( !fBlockList.IsBlocked(sampleNo) )
|
||||
{
|
||||
fBlockList.BlockVolume(sampleNo);
|
||||
@@ -235,7 +236,7 @@ G4VoxelSafety::SafetyForVoxelHeader( const G4SmartVoxelHeader* pHeader,
|
||||
// fVoxelDepth set by ComputeSafety or previous level call
|
||||
|
||||
targetHeaderAxis = targetVoxelHeader->GetAxis();
|
||||
targetHeaderNoSlices = targetVoxelHeader->GetNoSlices();
|
||||
targetHeaderNoSlices = (G4int)targetVoxelHeader->GetNoSlices();
|
||||
targetHeaderMin = targetVoxelHeader->GetMinExtent();
|
||||
targetHeaderMax = targetVoxelHeader->GetMaxExtent();
|
||||
|
||||
|
||||
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-10 Gabriele Cosmo (geom-bool-V11-00-07)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-10-27 Evgueni Tcherniaev (geom-bool-V11-00-06)
|
||||
- G4SubtractionSolid::GetCubicVolume(): Fix problem of non-zero volume for
|
||||
null resulting objects.
|
||||
|
||||
## 2022-05-04 Gabriele Cosmo (geom-bool-V11-00-05)
|
||||
- Minor cleanup in headers and G4UnionSolid constructors.
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ void G4BooleanSolid::GetListOfPrimitives(
|
||||
|
||||
G4ThreeVector G4BooleanSolid::GetPointOnSurface() const
|
||||
{
|
||||
size_t nprims = fPrimitives.size();
|
||||
std::size_t nprims = fPrimitives.size();
|
||||
std::pair<G4VSolid *, G4Transform3D> prim;
|
||||
|
||||
// Get list of primitives and find the total area of their surfaces
|
||||
@@ -302,7 +302,7 @@ G4ThreeVector G4BooleanSolid::GetPointOnSurface() const
|
||||
GetListOfPrimitives(fPrimitives, G4Transform3D());
|
||||
nprims = fPrimitives.size();
|
||||
fPrimitivesSurfaceArea = 0.;
|
||||
for (size_t i=0; i<nprims; ++i)
|
||||
for (std::size_t i=0; i<nprims; ++i)
|
||||
{
|
||||
fPrimitivesSurfaceArea += fPrimitives[i].first->GetSurfaceArea();
|
||||
}
|
||||
@@ -312,11 +312,11 @@ G4ThreeVector G4BooleanSolid::GetPointOnSurface() const
|
||||
// check that the point belongs to the surface of the solid
|
||||
//
|
||||
G4ThreeVector p;
|
||||
for (size_t k=0; k<100000; ++k) // try 100k times
|
||||
for (std::size_t k=0; k<100000; ++k) // try 100k times
|
||||
{
|
||||
G4double rand = fPrimitivesSurfaceArea * G4QuickRand();
|
||||
G4double area = 0.;
|
||||
for (size_t i=0; i<nprims; ++i)
|
||||
for (std::size_t i=0; i<nprims; ++i)
|
||||
{
|
||||
prim = fPrimitives[i];
|
||||
area += prim.first->GetSurfaceArea();
|
||||
|
||||
@@ -301,8 +301,8 @@ G4IntersectionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
G4double dB = 0., dB1=0., dB2=0.;
|
||||
G4bool doA = true, doB = true;
|
||||
|
||||
static const size_t max_trials=10000;
|
||||
for (size_t trial=0; trial<max_trials; ++trial)
|
||||
static const std::size_t max_trials=10000;
|
||||
for (std::size_t trial=0; trial<max_trials; ++trial)
|
||||
{
|
||||
if(doA)
|
||||
{
|
||||
|
||||
@@ -157,8 +157,8 @@ G4MultiUnion::DistanceToInNoVoxels(const G4ThreeVector& aPoint,
|
||||
G4ThreeVector localPoint, localDirection;
|
||||
G4double minDistance = kInfinity;
|
||||
|
||||
G4int numNodes = fSolids.size();
|
||||
for (G4int i = 0 ; i < numNodes ; ++i)
|
||||
std::size_t numNodes = fSolids.size();
|
||||
for (std::size_t i = 0 ; i < numNodes ; ++i)
|
||||
{
|
||||
G4VSolid& solid = *fSolids[i];
|
||||
const G4Transform3D& transform = fTransformObjs[i];
|
||||
@@ -178,11 +178,11 @@ G4double G4MultiUnion::DistanceToInCandidates(const G4ThreeVector& aPoint,
|
||||
std::vector<G4int>& candidates,
|
||||
G4SurfBits& bits) const
|
||||
{
|
||||
G4int candidatesCount = candidates.size();
|
||||
std::size_t candidatesCount = candidates.size();
|
||||
G4ThreeVector localPoint, localDirection;
|
||||
|
||||
G4double minDistance = kInfinity;
|
||||
for (G4int i = 0 ; i < candidatesCount; ++i)
|
||||
for (std::size_t i = 0 ; i < candidatesCount; ++i)
|
||||
{
|
||||
G4int candidate = candidates[i];
|
||||
G4VSolid& solid = *fSolids[candidate];
|
||||
@@ -261,8 +261,8 @@ G4double G4MultiUnion::DistanceToOutNoVoxels(const G4ThreeVector& aPoint,
|
||||
G4double resultDistToOut = 0;
|
||||
G4ThreeVector currentPoint = aPoint;
|
||||
|
||||
G4int numNodes = fSolids.size();
|
||||
for (G4int i = 0; i < numNodes; ++i)
|
||||
G4int numNodes = (G4int)fSolids.size();
|
||||
for (auto i = 0; i < numNodes; ++i)
|
||||
{
|
||||
if (i != ignoredSolid)
|
||||
{
|
||||
@@ -325,8 +325,8 @@ G4double G4MultiUnion::DistanceToOutVoxels(const G4ThreeVector& aPoint,
|
||||
G4ThreeVector direction = aDirection.unit();
|
||||
std::vector<G4int> candidates;
|
||||
G4double distance = 0;
|
||||
G4int numNodes = 2*fSolids.size();
|
||||
G4int count=0;
|
||||
std::size_t numNodes = 2*fSolids.size();
|
||||
std::size_t count=0;
|
||||
|
||||
if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates))
|
||||
{
|
||||
@@ -345,8 +345,8 @@ G4double G4MultiUnion::DistanceToOutVoxels(const G4ThreeVector& aPoint,
|
||||
G4int maxCandidate = 0;
|
||||
G4ThreeVector maxLocalPoint;
|
||||
|
||||
G4int limit = candidates.size();
|
||||
for (G4int i = 0 ; i < limit ; ++i)
|
||||
std::size_t limit = candidates.size();
|
||||
for (std::size_t i = 0 ; i < limit ; ++i)
|
||||
{
|
||||
G4int candidate = candidates[i];
|
||||
// ignore the current component (that you just got out of) since
|
||||
@@ -479,11 +479,11 @@ EInside G4MultiUnion::InsideWithExclusion(const G4ThreeVector& aPoint,
|
||||
// surface, the surface points will be considered as kSurface, while points
|
||||
// located around will correspond to kInside (cf. G4UnionSolid)
|
||||
|
||||
G4int size = surfaces.size();
|
||||
for (G4int i = 0; i < size - 1; ++i)
|
||||
std::size_t size = surfaces.size();
|
||||
for (std::size_t i = 0; i < size - 1; ++i)
|
||||
{
|
||||
G4MultiUnionSurface& left = surfaces[i];
|
||||
for (G4int j = i + 1; j < size; ++j)
|
||||
for (std::size_t j = i + 1; j < size; ++j)
|
||||
{
|
||||
G4MultiUnionSurface& right = surfaces[j];
|
||||
G4ThreeVector n, n2;
|
||||
@@ -526,8 +526,8 @@ EInside G4MultiUnion::InsideNoVoxels(const G4ThreeVector& aPoint) const
|
||||
EInside location = EInside::kOutside;
|
||||
G4int countSurface = 0;
|
||||
|
||||
G4int numNodes = fSolids.size();
|
||||
for (G4int i = 0 ; i < numNodes ; ++i)
|
||||
G4int numNodes = (G4int)fSolids.size();
|
||||
for (auto i = 0 ; i < numNodes ; ++i)
|
||||
{
|
||||
G4VSolid& solid = *fSolids[i];
|
||||
G4Transform3D transform = GetTransformation(i);
|
||||
@@ -553,8 +553,8 @@ void G4MultiUnion::Extent(EAxis aAxis, G4double& aMin, G4double& aMax) const
|
||||
// Determines the bounding box for the considered instance of "UMultipleUnion"
|
||||
G4ThreeVector min, max;
|
||||
|
||||
G4int numNodes = fSolids.size();
|
||||
for (G4int i = 0 ; i < numNodes ; ++i)
|
||||
G4int numNodes = (G4int)fSolids.size();
|
||||
for (auto i = 0 ; i < numNodes ; ++i)
|
||||
{
|
||||
G4VSolid& solid = *fSolids[i];
|
||||
G4Transform3D transform = GetTransformation(i);
|
||||
@@ -661,8 +661,8 @@ G4ThreeVector G4MultiUnion::SurfaceNormal(const G4ThreeVector& aPoint) const
|
||||
// determine weather we are in voxel area
|
||||
if (fVoxels.GetCandidatesVoxelArray(aPoint, candidates))
|
||||
{
|
||||
G4int limit = candidates.size();
|
||||
for (G4int i = 0 ; i < limit ; ++i)
|
||||
std::size_t limit = candidates.size();
|
||||
for (std::size_t i = 0 ; i < limit ; ++i)
|
||||
{
|
||||
G4int candidate = candidates[i];
|
||||
const G4Transform3D& transform = fTransformObjs[candidate];
|
||||
@@ -735,8 +735,8 @@ G4double G4MultiUnion::DistanceToOut(const G4ThreeVector& point) const
|
||||
// but only an undervalue (cf. overlaps)
|
||||
fVoxels.GetCandidatesVoxelArray(point, candidates);
|
||||
|
||||
G4int limit = candidates.size();
|
||||
for (G4int i = 0; i < limit; ++i)
|
||||
std::size_t limit = candidates.size();
|
||||
for (std::size_t i = 0; i < limit; ++i)
|
||||
{
|
||||
G4int candidate = candidates[i];
|
||||
|
||||
@@ -769,8 +769,8 @@ G4double G4MultiUnion::DistanceToIn(const G4ThreeVector& point) const
|
||||
G4double safetyMin = kInfinity;
|
||||
G4ThreeVector localPoint;
|
||||
|
||||
G4int numNodes = fSolids.size();
|
||||
for (G4int j = 0; j < numNodes; ++j)
|
||||
std::size_t numNodes = fSolids.size();
|
||||
for (std::size_t j = 0; j < numNodes; ++j)
|
||||
{
|
||||
G4ThreeVector dxyz;
|
||||
if (j > 0)
|
||||
@@ -833,11 +833,11 @@ G4int G4MultiUnion::SafetyFromOutsideNumberNode(const G4ThreeVector& aPoint,
|
||||
|
||||
const std::vector<G4VoxelBox>& boxes = fVoxels.GetBoxes();
|
||||
safetyMin = kInfinity;
|
||||
G4int safetyNode = 0;
|
||||
std::size_t safetyNode = 0;
|
||||
G4ThreeVector localPoint;
|
||||
|
||||
G4int numNodes = fSolids.size();
|
||||
for (G4int i = 0; i < numNodes; ++i)
|
||||
std::size_t numNodes = fSolids.size();
|
||||
for (std::size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
G4double d2xyz = 0.;
|
||||
G4double dxyz0 = std::abs(aPoint.x() - boxes[i].pos.x()) - boxes[i].hlen.x();
|
||||
@@ -864,7 +864,7 @@ G4int G4MultiUnion::SafetyFromOutsideNumberNode(const G4ThreeVector& aPoint,
|
||||
safetyNode = i;
|
||||
}
|
||||
}
|
||||
return safetyNode;
|
||||
return (G4int)safetyNode;
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
@@ -914,14 +914,14 @@ void G4MultiUnion::TransformLimits(G4ThreeVector& min, G4ThreeVector& max,
|
||||
//______________________________________________________________________________
|
||||
std::ostream& G4MultiUnion::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
<< " Solid type: G4MultiUnion\n"
|
||||
<< " Parameters: \n";
|
||||
G4int numNodes = fSolids.size();
|
||||
for (G4int i = 0 ; i < numNodes ; ++i)
|
||||
std::size_t numNodes = fSolids.size();
|
||||
for (std::size_t i = 0 ; i < numNodes ; ++i)
|
||||
{
|
||||
G4VSolid& solid = *fSolids[i];
|
||||
solid.StreamInfo(os);
|
||||
|
||||
@@ -591,7 +591,7 @@ G4double G4SubtractionSolid::GetCubicVolume()
|
||||
fPtrSolidA->BoundingLimits(bminA, bmaxA);
|
||||
fPtrSolidB->BoundingLimits(bminB, bmaxB);
|
||||
G4double intersection = 0.;
|
||||
G4bool canIntersect =
|
||||
G4bool canIntersect =
|
||||
bminA.x() < bmaxB.x() && bminA.y() < bmaxB.y() && bminA.z() < bmaxB.z() &&
|
||||
bminB.x() < bmaxA.x() && bminB.y() < bmaxA.y() && bminB.z() < bmaxA.z();
|
||||
if ( canIntersect )
|
||||
@@ -602,6 +602,7 @@ G4double G4SubtractionSolid::GetCubicVolume()
|
||||
}
|
||||
|
||||
fCubicVolume = cubVolumeA - intersection;
|
||||
if (fCubicVolume < 0.01*cubVolumeA) fCubicVolume = G4VSolid::GetCubicVolume();
|
||||
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
# Category geom-csg History
|
||||
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-10 Gabriele Cosmo (geom-csg-V11-00-02)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-09-19 Ben Morgan (geom-csg-V11-00-01)
|
||||
- G4Cons: define private enums within unnamed namespace, to overcome
|
||||
C++ ODR (One Definition Rule) violation.
|
||||
|
||||
## 2021-12-10 Ben Morgan (geom-csg-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
@@ -479,7 +479,7 @@ G4GeometryType G4Box::GetEntityType() const
|
||||
|
||||
std::ostream& G4Box::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -56,13 +56,18 @@ using namespace CLHEP;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Private enum: Not for external use - used by distanceToOut
|
||||
// Private enums: Not for external use
|
||||
|
||||
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
|
||||
namespace
|
||||
{
|
||||
// used by DistanceToOut()
|
||||
//
|
||||
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
|
||||
|
||||
// used by normal
|
||||
|
||||
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
|
||||
// used by ApproxSurfaceNormal()
|
||||
//
|
||||
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -1408,7 +1413,7 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
// Vars for intersection within tolerance
|
||||
|
||||
ESide sidetol = kNull ;
|
||||
ESide sidetol = kNull ;
|
||||
G4double slentol = kInfinity ;
|
||||
|
||||
// Vars for phi intersection:
|
||||
@@ -1978,7 +1983,7 @@ G4double G4Cons::DistanceToOut( const G4ThreeVector& p,
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16) ;
|
||||
G4long oldprc = message.precision(16) ;
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
@@ -2111,7 +2116,7 @@ G4VSolid* G4Cons::Clone() const
|
||||
|
||||
std::ostream& G4Cons::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -1823,7 +1823,7 @@ G4double G4CutTubs::DistanceToOut( const G4ThreeVector& p,
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
@@ -1917,7 +1917,7 @@ G4VSolid* G4CutTubs::Clone() const
|
||||
|
||||
std::ostream& G4CutTubs::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -423,7 +423,7 @@ G4VSolid* G4Orb::Clone() const
|
||||
|
||||
std::ostream& G4Orb::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -105,7 +105,7 @@ G4Para::G4Para( const G4String& pName,
|
||||
if (discrepancy > 0.1*kCarTolerance)
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Invalid vertice coordinates for Solid: " << GetName()
|
||||
<< "\nVertix #" << i << ", discrepancy = " << discrepancy
|
||||
<< "\n original : " << pt[i]
|
||||
@@ -816,7 +816,7 @@ std::ostream& G4Para::StreamInfo( std::ostream& os ) const
|
||||
fTthetaSphi*fTthetaSphi));
|
||||
G4double phi = std::atan2(fTthetaSphi,fTthetaCphi);
|
||||
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -2587,7 +2587,7 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
@@ -2611,7 +2611,7 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Logic error: snxt = kInfinity ???" << G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
<< "p.x() = " << p.x()/mm << " mm" << G4endl
|
||||
@@ -2649,7 +2649,7 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p ) const
|
||||
#ifdef G4CSGDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4int old_prc = G4cout.precision(16);
|
||||
G4long old_prc = G4cout.precision(16);
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl ;
|
||||
@@ -2750,7 +2750,7 @@ G4VSolid* G4Sphere::Clone() const
|
||||
|
||||
std::ostream& G4Sphere::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -297,7 +297,7 @@ G4double G4Torus::SolveNumericJT( const G4ThreeVector& p,
|
||||
|
||||
// determine the smallest non-negative solution
|
||||
//
|
||||
for ( size_t k = 0 ; k<roots.size() ; ++k )
|
||||
for ( std::size_t k = 0 ; k<roots.size() ; ++k )
|
||||
{
|
||||
t = roots[k] ;
|
||||
|
||||
@@ -1460,7 +1460,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p,
|
||||
G4cout << G4endl;
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
@@ -1500,7 +1500,7 @@ G4double G4Torus::DistanceToOut( const G4ThreeVector& p ) const
|
||||
#ifdef G4CSGDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4int oldprc = G4cout.precision(16) ;
|
||||
G4long oldprc = G4cout.precision(16) ;
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl ;
|
||||
@@ -1573,7 +1573,7 @@ G4VSolid* G4Torus::Clone() const
|
||||
|
||||
std::ostream& G4Torus::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -779,7 +779,7 @@ G4ThreeVector G4Trap::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -1039,7 +1039,7 @@ G4double G4Trap::DistanceToOut( const G4ThreeVector& p ) const
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: " << GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
@@ -1129,7 +1129,7 @@ std::ostream& G4Trap::StreamInfo( std::ostream& os ) const
|
||||
G4double alpha1 = GetAlpha1();
|
||||
G4double alpha2 = GetAlpha2();
|
||||
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid: " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -404,7 +404,7 @@ G4ThreeVector G4Trd::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -648,7 +648,7 @@ G4double G4Trd::DistanceToOut( const G4ThreeVector& p ) const
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: " << GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
message << " p.x() = " << p.x()/mm << " mm\n";
|
||||
@@ -694,7 +694,7 @@ G4VSolid* G4Trd::Clone() const
|
||||
|
||||
std::ostream& G4Trd::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -577,7 +577,7 @@ G4ThreeVector G4Tubs::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
#ifdef G4CSGDEBUG
|
||||
G4Exception("G4Tubs::SurfaceNormal(p)", "GeomSolids1002",
|
||||
JustWarning, "Point p is not on surface !?" );
|
||||
G4int oldprc = G4cout.precision(20);
|
||||
G4long oldprc = G4cout.precision(20);
|
||||
G4cout<< "G4Tubs::SN ( "<<p.x()<<", "<<p.y()<<", "<<p.z()<<" ); "
|
||||
<< G4endl << G4endl;
|
||||
G4cout.precision(oldprc) ;
|
||||
@@ -1541,7 +1541,7 @@ G4double G4Tubs::DistanceToOut( const G4ThreeVector& p,
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl << G4endl
|
||||
@@ -1577,7 +1577,7 @@ G4double G4Tubs::DistanceToOut( const G4ThreeVector& p ) const
|
||||
#ifdef G4CSGDEBUG
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4int oldprc = G4cout.precision(16) ;
|
||||
G4long oldprc = G4cout.precision(16) ;
|
||||
G4cout << G4endl ;
|
||||
DumpInfo();
|
||||
G4cout << "Position:" << G4endl << G4endl ;
|
||||
@@ -1649,7 +1649,7 @@ G4VSolid* G4Tubs::Clone() const
|
||||
|
||||
std::ostream& G4Tubs::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -106,7 +106,7 @@ G4UPara::G4UPara( const G4String& pName,
|
||||
if (discrepancy > 0.1*kCarTolerance)
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Invalid vertice coordinates for Solid: " << GetName()
|
||||
<< "\nVertix #" << i << ", discrepancy = " << discrepancy
|
||||
<< "\n original : " << pt[i]
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
# Category geom-specific History
|
||||
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-10 Gabriele Cosmo (geom-specific-V11-00-10)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-10-05 Gabriele Cosmo (geom-specific-V11-00-09)
|
||||
- Fixed compilation warnings in Intel/icx compiler for variables set
|
||||
but never used.
|
||||
|
||||
## 2022-04-03 Evgueni Tcherniaev (geom-specific-V11-00-08)
|
||||
- G4GenericTrap.cc, G4UGenericTrap.cc, G4UExtrudedSolid.cc,
|
||||
|
||||
@@ -81,7 +81,7 @@ class G4ClippablePolygon
|
||||
// Returns pointer to maximum point along the specified axis.
|
||||
// Take care! Do not use pointer after destroying parent polygon.
|
||||
|
||||
inline G4int GetNumVertices() const;
|
||||
inline std::size_t GetNumVertices() const;
|
||||
inline G4bool Empty() const;
|
||||
|
||||
virtual G4bool InFrontOf( const G4ClippablePolygon& other, EAxis axis ) const;
|
||||
|
||||
@@ -39,7 +39,7 @@ const G4ThreeVector G4ClippablePolygon::GetNormal() const
|
||||
}
|
||||
|
||||
inline
|
||||
G4int G4ClippablePolygon::GetNumVertices() const
|
||||
std::size_t G4ClippablePolygon::GetNumVertices() const
|
||||
{
|
||||
return vertices.size();
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ class G4ExtrudedSolid : public G4TessellatedSolid
|
||||
|
||||
private:
|
||||
|
||||
G4int fNv;
|
||||
G4int fNz;
|
||||
std::size_t fNv;
|
||||
std::size_t fNz;
|
||||
std::vector<G4TwoVector> fPolygon;
|
||||
std::vector<ZSection> fZSections;
|
||||
std::vector< std::vector<G4int> > fTriangles;
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
inline
|
||||
G4int G4ExtrudedSolid::GetNofVertices() const
|
||||
{
|
||||
return fNv;
|
||||
return (G4int)fNv;
|
||||
}
|
||||
|
||||
inline G4TwoVector G4ExtrudedSolid::GetVertex(G4int index) const
|
||||
{
|
||||
if ( index<0 || index >= fNv )
|
||||
if ( index<0 || index >= (G4int)fNv )
|
||||
{
|
||||
G4Exception ("G4ExtrudedSolid::GetVertex()", "GeomSolids0003",
|
||||
FatalException, "Index outside range.");
|
||||
@@ -52,13 +52,13 @@ std::vector<G4TwoVector> G4ExtrudedSolid::GetPolygon() const
|
||||
inline
|
||||
G4int G4ExtrudedSolid::GetNofZSections() const
|
||||
{
|
||||
return fNz;
|
||||
return (G4int)fNz;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ExtrudedSolid::ZSection G4ExtrudedSolid::GetZSection(G4int index) const
|
||||
{
|
||||
if ( index<0 || index >= fNz )
|
||||
if ( index<0 || index >= (G4int)fNz )
|
||||
{
|
||||
G4Exception ("G4ExtrudedSolid::GetZSection()", "GeomSolids0003",
|
||||
FatalException, "Index outside range.");
|
||||
@@ -78,7 +78,7 @@ G4bool G4ExtrudedSolid::PointInPolygon(const G4ThreeVector& p) const
|
||||
{
|
||||
G4bool in = 0;
|
||||
G4int icur = (fPolygon[fNv-1].y() > p.y()), iprev = 0;
|
||||
for (G4int i = 0; i < fNv; ++i)
|
||||
for (std::size_t i = 0; i < fNv; ++i)
|
||||
{
|
||||
iprev = icur;
|
||||
if ((icur = (fPolygon[i].y() > p.y())) != iprev)
|
||||
@@ -93,7 +93,7 @@ inline
|
||||
G4double G4ExtrudedSolid::DistanceToPolygonSqr(const G4ThreeVector& p) const
|
||||
{
|
||||
G4double dd = DBL_MAX;
|
||||
for (G4int i=0, k=fNv-1; i<fNv; k=i++)
|
||||
for (std::size_t i=0, k=fNv-1; i<fNv; k=i++)
|
||||
{
|
||||
G4double ix = p.x() - fPolygon[i].x();
|
||||
G4double iy = p.y() - fPolygon[i].y();
|
||||
|
||||
@@ -101,7 +101,7 @@ G4bool G4ClippablePolygon::GetExtent( const EAxis axis,
|
||||
//
|
||||
// Okay, how many entries do we have?
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
|
||||
//
|
||||
// Return false if nothing is left
|
||||
@@ -116,7 +116,7 @@ G4bool G4ClippablePolygon::GetExtent( const EAxis axis,
|
||||
//
|
||||
// Compare to the rest
|
||||
//
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = vertices[i].operator()( axis );
|
||||
if (component < min )
|
||||
@@ -135,15 +135,17 @@ G4bool G4ClippablePolygon::GetExtent( const EAxis axis,
|
||||
//
|
||||
const G4ThreeVector* G4ClippablePolygon::GetMinPoint( const EAxis axis ) const
|
||||
{
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0)
|
||||
{
|
||||
G4Exception("G4ClippablePolygon::GetMinPoint()",
|
||||
"GeomSolids0002", FatalException, "Empty polygon.");
|
||||
|
||||
}
|
||||
|
||||
const G4ThreeVector *answer = &(vertices[0]);
|
||||
G4double min = answer->operator()(axis);
|
||||
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = vertices[i].operator()( axis );
|
||||
if (component < min)
|
||||
@@ -163,15 +165,17 @@ const G4ThreeVector* G4ClippablePolygon::GetMinPoint( const EAxis axis ) const
|
||||
//
|
||||
const G4ThreeVector* G4ClippablePolygon::GetMaxPoint( const EAxis axis ) const
|
||||
{
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0)
|
||||
{
|
||||
G4Exception("G4ClippablePolygon::GetMaxPoint()",
|
||||
"GeomSolids0002", FatalException, "Empty polygon.");
|
||||
|
||||
}
|
||||
|
||||
const G4ThreeVector *answer = &(vertices[0]);
|
||||
G4double max = answer->operator()(axis);
|
||||
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = vertices[i].operator()( axis );
|
||||
if (component > max)
|
||||
@@ -205,7 +209,7 @@ G4bool G4ClippablePolygon::InFrontOf( const G4ClippablePolygon& other,
|
||||
//
|
||||
// If things are empty, do something semi-sensible
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0) return false;
|
||||
|
||||
if (other.Empty()) return true;
|
||||
@@ -269,7 +273,7 @@ G4bool G4ClippablePolygon::BehindOf( const G4ClippablePolygon& other,
|
||||
//
|
||||
// If things are empty, do something semi-sensible
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
if (noLeft==0) return false;
|
||||
|
||||
if (other.Empty()) return true;
|
||||
@@ -334,7 +338,7 @@ G4bool G4ClippablePolygon::GetPlanerExtent( const G4ThreeVector& pointOnPlane,
|
||||
//
|
||||
// Okay, how many entries do we have?
|
||||
//
|
||||
G4int noLeft = vertices.size();
|
||||
std::size_t noLeft = vertices.size();
|
||||
|
||||
//
|
||||
// Return false if nothing is left
|
||||
@@ -349,7 +353,7 @@ G4bool G4ClippablePolygon::GetPlanerExtent( const G4ThreeVector& pointOnPlane,
|
||||
//
|
||||
// Compare to the rest
|
||||
//
|
||||
for( G4int i=1; i<noLeft; ++i )
|
||||
for( std::size_t i=1; i<noLeft; ++i )
|
||||
{
|
||||
G4double component = planeNormal.dot(vertices[i] - pointOnPlane);
|
||||
if (component < min )
|
||||
@@ -413,12 +417,12 @@ void G4ClippablePolygon::ClipToSimpleLimits( G4ThreeVectorList& pPolygon,
|
||||
G4ThreeVectorList& outputPolygon,
|
||||
const G4VoxelLimits& pVoxelLimit )
|
||||
{
|
||||
G4int noVertices = pPolygon.size();
|
||||
std::size_t noVertices = pPolygon.size();
|
||||
G4ThreeVector vEnd,vStart;
|
||||
|
||||
outputPolygon.clear();
|
||||
|
||||
for (G4int i=0; i<noVertices; ++i)
|
||||
for (std::size_t i=0; i<noVertices; ++i)
|
||||
{
|
||||
vStart=pPolygon[i];
|
||||
if (i==noVertices-1)
|
||||
|
||||
@@ -342,7 +342,7 @@ G4ThreeVector G4Ellipsoid::SurfaceNormal( const G4ThreeVector& p) const
|
||||
{
|
||||
#ifdef G4SPECSDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << "\n";
|
||||
message << "Position:\n";
|
||||
@@ -542,7 +542,7 @@ G4double G4Ellipsoid::DistanceToOut(const G4ThreeVector& p,
|
||||
{
|
||||
#ifdef G4SPECSDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position: " << p << G4endl;;
|
||||
@@ -659,7 +659,7 @@ G4VSolid* G4Ellipsoid::Clone() const
|
||||
|
||||
std::ostream& G4Ellipsoid::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -304,7 +304,7 @@ G4ThreeVector G4EllipticalCone::SurfaceNormal( const G4ThreeVector& p) const
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -738,7 +738,7 @@ G4double G4EllipticalCone::DistanceToOut(const G4ThreeVector& p,
|
||||
default: // Should never reach this case ...
|
||||
DumpInfo();
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Undefined side for valid surface normal to solid."
|
||||
<< G4endl
|
||||
<< "Position:" << G4endl
|
||||
@@ -774,7 +774,7 @@ G4double G4EllipticalCone::DistanceToOut(const G4ThreeVector& p) const
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: " << GetName() << "\n"
|
||||
<< "Position:\n"
|
||||
<< " p.x() = " << p.x()/mm << " mm\n"
|
||||
@@ -817,7 +817,7 @@ G4VSolid* G4EllipticalCone::Clone() const
|
||||
|
||||
std::ostream& G4EllipticalCone::StreamInfo( std::ostream& os ) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -306,7 +306,7 @@ G4ThreeVector G4EllipticalTube::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
//
|
||||
#ifdef G4SPECDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -505,7 +505,7 @@ G4double G4EllipticalTube::DistanceToOut( const G4ThreeVector& p,
|
||||
{
|
||||
#ifdef G4SPECDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position: " << p << G4endl;;
|
||||
@@ -588,7 +588,7 @@ G4double G4EllipticalTube::DistanceToOut( const G4ThreeVector& p ) const
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is outside (!?) of solid: " << GetName() << "\n"
|
||||
<< "Position:\n"
|
||||
<< " p.x() = " << p.x()/mm << " mm\n"
|
||||
@@ -683,7 +683,7 @@ G4double G4EllipticalTube::GetSurfaceArea()
|
||||
|
||||
std::ostream& G4EllipticalTube::StreamInfo(std::ostream& os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
|
||||
@@ -93,7 +93,7 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
|
||||
FatalErrorInArgument, message);
|
||||
}
|
||||
|
||||
for ( G4int i=0; i<fNz-1; ++i )
|
||||
for ( std::size_t i=0; i<fNz-1; ++i )
|
||||
{
|
||||
if ( zsections[i].fZ > zsections[i+1].fZ )
|
||||
{
|
||||
@@ -124,13 +124,13 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
|
||||
2*kCarTolerance);
|
||||
if (removedVertices.size() != 0)
|
||||
{
|
||||
G4int nremoved = removedVertices.size();
|
||||
std::size_t nremoved = removedVertices.size();
|
||||
std::ostringstream message;
|
||||
message << "The following "<< nremoved
|
||||
<< " vertices have been removed from polygon in " << pName
|
||||
<< "\nas collinear or coincident with other vertices: "
|
||||
<< removedVertices[0];
|
||||
for (G4int i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
for (std::size_t i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "GeomSolids1001",
|
||||
JustWarning, message);
|
||||
}
|
||||
@@ -219,13 +219,13 @@ G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
|
||||
2*kCarTolerance);
|
||||
if (removedVertices.size() != 0)
|
||||
{
|
||||
G4int nremoved = removedVertices.size();
|
||||
std::size_t nremoved = removedVertices.size();
|
||||
std::ostringstream message;
|
||||
message << "The following "<< nremoved
|
||||
<< " vertices have been removed from polygon in " << pName
|
||||
<< "\nas collinear or coincident with other vertices: "
|
||||
<< removedVertices[0];
|
||||
for (G4int i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
for (std::size_t i=1; i<nremoved; ++i) message << ", " << removedVertices[i];
|
||||
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "GeomSolids1001",
|
||||
JustWarning, message);
|
||||
}
|
||||
@@ -347,7 +347,7 @@ void G4ExtrudedSolid::ComputeProjectionParameters()
|
||||
// p0 = (p(z) - offset(z))/scale(z);
|
||||
//
|
||||
|
||||
for ( G4int iz=0; iz<fNz-1; ++iz)
|
||||
for (std::size_t iz=0; iz<fNz-1; ++iz)
|
||||
{
|
||||
G4double z1 = fZSections[iz].fZ;
|
||||
G4double z2 = fZSections[iz+1].fZ;
|
||||
@@ -374,9 +374,9 @@ void G4ExtrudedSolid::ComputeLateralPlanes()
|
||||
{
|
||||
// Compute lateral planes: a*x + b*y + c*z + d = 0
|
||||
//
|
||||
G4int Nv = fPolygon.size();
|
||||
std::size_t Nv = fPolygon.size();
|
||||
fPlanes.resize(Nv);
|
||||
for (G4int i=0, k=Nv-1; i<Nv; k=i++)
|
||||
for (std::size_t i=0, k=Nv-1; i<Nv; k=i++)
|
||||
{
|
||||
G4TwoVector norm = (fPolygon[i] - fPolygon[k]).unit();
|
||||
fPlanes[i].a = -norm.y();
|
||||
@@ -390,7 +390,7 @@ void G4ExtrudedSolid::ComputeLateralPlanes()
|
||||
//
|
||||
fLines.resize(Nv);
|
||||
fLengths.resize(Nv);
|
||||
for (G4int i=0, k=Nv-1; i<Nv; k=i++)
|
||||
for (std::size_t i=0, k=Nv-1; i<Nv; k=i++)
|
||||
{
|
||||
if (fPolygon[k].y() == fPolygon[i].y())
|
||||
{
|
||||
@@ -431,7 +431,7 @@ G4TwoVector G4ExtrudedSolid::ProjectPoint(const G4ThreeVector& point) const
|
||||
|
||||
// Select projection (z-segment of the solid) according to p.z()
|
||||
//
|
||||
G4int iz = 0;
|
||||
std::size_t iz = 0;
|
||||
while ( point.z() > fZSections[iz+1].fZ && iz < fNz-2 ) { ++iz; }
|
||||
// Loop checking, 13.08.2015, G.Cosmo
|
||||
|
||||
@@ -607,9 +607,9 @@ G4ExtrudedSolid::MakeUpFacet(G4int ind1, G4int ind2, G4int ind3) const
|
||||
// forming the upper side ( z>0 )
|
||||
|
||||
std::vector<G4ThreeVector> vertices;
|
||||
vertices.push_back(GetVertex(fNz-1, ind1));
|
||||
vertices.push_back(GetVertex(fNz-1, ind2));
|
||||
vertices.push_back(GetVertex(fNz-1, ind3));
|
||||
vertices.push_back(GetVertex((G4int)fNz-1, ind1));
|
||||
vertices.push_back(GetVertex((G4int)fNz-1, ind2));
|
||||
vertices.push_back(GetVertex((G4int)fNz-1, ind3));
|
||||
|
||||
// first vertex most left
|
||||
//
|
||||
@@ -646,7 +646,7 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
|
||||
// Fill one more vector
|
||||
//
|
||||
std::vector< Vertex > verticesToBeDone;
|
||||
for ( G4int i=0; i<fNv; ++i )
|
||||
for ( G4int i=0; i<(G4int)fNv; ++i )
|
||||
{
|
||||
verticesToBeDone.push_back(Vertex(fPolygon[i], i));
|
||||
}
|
||||
@@ -671,7 +671,7 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
|
||||
|
||||
//G4cout << "angle " << angle << G4endl;
|
||||
|
||||
G4int counter = 0;
|
||||
std::size_t counter = 0;
|
||||
while ( angle >= (pi-kAngTolerance) ) // Loop checking, 13.08.2015, G.Cosmo
|
||||
{
|
||||
// G4cout << "Skipping concave vertex " << c2->second << G4endl;
|
||||
@@ -692,7 +692,7 @@ G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
|
||||
|
||||
++counter;
|
||||
|
||||
if ( counter > fNv)
|
||||
if ( counter > fNv )
|
||||
{
|
||||
G4Exception("G4ExtrudedSolid::AddGeneralPolygonFacets",
|
||||
"GeomSolids0003", FatalException,
|
||||
@@ -772,9 +772,9 @@ G4bool G4ExtrudedSolid::MakeFacets()
|
||||
GetVertex(0, 2), ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
good = AddFacet( new G4TriangularFacet( GetVertex(fNz-1, 2),
|
||||
GetVertex(fNz-1, 1),
|
||||
GetVertex(fNz-1, 0),
|
||||
good = AddFacet( new G4TriangularFacet( GetVertex((G4int)fNz-1, 2),
|
||||
GetVertex((G4int)fNz-1, 1),
|
||||
GetVertex((G4int)fNz-1, 0),
|
||||
ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
@@ -792,10 +792,10 @@ G4bool G4ExtrudedSolid::MakeFacets()
|
||||
ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
good = AddFacet( new G4QuadrangularFacet( GetVertex(fNz-1, 3),
|
||||
GetVertex(fNz-1, 2),
|
||||
GetVertex(fNz-1, 1),
|
||||
GetVertex(fNz-1, 0),
|
||||
good = AddFacet( new G4QuadrangularFacet( GetVertex((G4int)fNz-1, 3),
|
||||
GetVertex((G4int)fNz-1, 2),
|
||||
GetVertex((G4int)fNz-1, 1),
|
||||
GetVertex((G4int)fNz-1, 0),
|
||||
ABSOLUTE) );
|
||||
if ( ! good ) { return false; }
|
||||
|
||||
@@ -819,9 +819,9 @@ G4bool G4ExtrudedSolid::MakeFacets()
|
||||
|
||||
// The quadrangular sides
|
||||
//
|
||||
for ( G4int iz = 0; iz < fNz-1; ++iz )
|
||||
for ( G4int iz = 0; iz < (G4int)fNz-1; ++iz )
|
||||
{
|
||||
for ( G4int i = 0; i < fNv; ++i )
|
||||
for ( G4int i = 0; i < (G4int)fNv; ++i )
|
||||
{
|
||||
G4int j = (i+1) % fNv;
|
||||
good = AddFacet( new G4QuadrangularFacet
|
||||
@@ -863,8 +863,8 @@ EInside G4ExtrudedSolid::Inside(const G4ThreeVector &p) const
|
||||
G4double dist = std::max(fZSections[0].fZ-p.z(),p.z()-fZSections[1].fZ);
|
||||
if (dist > kCarToleranceHalf) { return kOutside; }
|
||||
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (dd > dist) { dist = dd; }
|
||||
@@ -915,7 +915,7 @@ EInside G4ExtrudedSolid::Inside(const G4ThreeVector &p) const
|
||||
|
||||
// Check if on surface of polygon
|
||||
//
|
||||
for ( G4int i=0; i<fNv; ++i )
|
||||
for ( G4int i=0; i<(G4int)fNv; ++i )
|
||||
{
|
||||
G4int j = (i+1) % fNv;
|
||||
if ( IsSameLineSegment(pscaled, fPolygon[i], fPolygon[j]) )
|
||||
@@ -966,7 +966,7 @@ EInside G4ExtrudedSolid::Inside(const G4ThreeVector &p) const
|
||||
G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
{
|
||||
G4int nsurf = 0;
|
||||
G4double nx = 0, ny = 0, nz = 0;
|
||||
G4double nx = 0., ny = 0., nz = 0.;
|
||||
switch (fSolidType)
|
||||
{
|
||||
case 1: // convex right prism
|
||||
@@ -979,7 +979,7 @@ G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
{
|
||||
nz = 1; ++nsurf;
|
||||
}
|
||||
for (G4int i=0; i<fNv; ++i)
|
||||
for (std::size_t i=0; i<fNv; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (std::abs(dd) > kCarToleranceHalf) continue;
|
||||
@@ -1001,7 +1001,7 @@ G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
}
|
||||
|
||||
G4double sqrCarToleranceHalf = kCarToleranceHalf*kCarToleranceHalf;
|
||||
for (G4int i=0, k=fNv-1; i<fNv; k=i++)
|
||||
for (std::size_t i=0, k=fNv-1; i<fNv; k=i++)
|
||||
{
|
||||
G4double ix = p.x() - fPolygon[i].x();
|
||||
G4double iy = p.y() - fPolygon[i].y();
|
||||
@@ -1049,7 +1049,7 @@ G4ThreeVector G4ExtrudedSolid::SurfaceNormal(const G4ThreeVector& p) const
|
||||
//
|
||||
#ifdef G4CSGDEBUG
|
||||
std::ostringstream message;
|
||||
G4int oldprc = message.precision(16);
|
||||
G4long oldprc = message.precision(16);
|
||||
message << "Point p is not on surface (!?) of solid: "
|
||||
<< GetName() << G4endl;
|
||||
message << "Position:\n";
|
||||
@@ -1083,9 +1083,9 @@ G4ThreeVector G4ExtrudedSolid::ApproxSurfaceNormal(const G4ThreeVector& p) const
|
||||
|
||||
// Find nearest lateral side and distance to it
|
||||
//
|
||||
G4int iside = 0;
|
||||
std::size_t iside = 0;
|
||||
G4double dd = DBL_MAX;
|
||||
for (G4int i=0, k=fNv-1; i<fNv; k=i++)
|
||||
for (std::size_t i=0, k=fNv-1; i<fNv; k=i++)
|
||||
{
|
||||
G4double ix = p.x() - fPolygon[i].x();
|
||||
G4double iy = p.y() - fPolygon[i].y();
|
||||
@@ -1179,9 +1179,9 @@ G4double G4ExtrudedSolid::DistanceToIn(const G4ThreeVector& p,
|
||||
|
||||
// Intersection with lateral planes
|
||||
//
|
||||
G4int np = fPlanes.size();
|
||||
std::size_t np = fPlanes.size();
|
||||
G4double txmin = tzmin, txmax = tzmax;
|
||||
for (G4int i=0; i<np; ++i)
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double cosa = fPlanes[i].a*v.x()+fPlanes[i].b*v.y();
|
||||
G4double dist = fPlanes[i].a*p.x()+fPlanes[i].b*p.y()+fPlanes[i].d;
|
||||
@@ -1223,8 +1223,8 @@ G4double G4ExtrudedSolid::DistanceToIn (const G4ThreeVector& p) const
|
||||
case 1: // convex right prism
|
||||
{
|
||||
G4double dist = std::max(fZSections[0].fZ-p.z(),p.z()-fZSections[1].fZ);
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (dd > dist) dist = dd;
|
||||
@@ -1292,8 +1292,8 @@ G4double G4ExtrudedSolid::DistanceToOut (const G4ThreeVector &p,
|
||||
|
||||
// Intersection with lateral planes
|
||||
//
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double cosa = fPlanes[i].a*v.x()+fPlanes[i].b*v.y();
|
||||
if (cosa > 0)
|
||||
@@ -1305,7 +1305,7 @@ G4double G4ExtrudedSolid::DistanceToOut (const G4ThreeVector &p,
|
||||
return 0;
|
||||
}
|
||||
G4double tmp = -dist/cosa;
|
||||
if (tmax > tmp) { tmax = tmp; iside = i; }
|
||||
if (tmax > tmp) { tmax = tmp; iside = (G4int)i; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1344,8 +1344,8 @@ G4double G4ExtrudedSolid::DistanceToOut(const G4ThreeVector& p) const
|
||||
case 1: // convex right prism
|
||||
{
|
||||
G4double dist = std::max(fZSections[0].fZ-p.z(),p.z()-fZSections[1].fZ);
|
||||
G4int np = fPlanes.size();
|
||||
for (G4int i=0; i<np; ++i)
|
||||
std::size_t np = fPlanes.size();
|
||||
for (std::size_t i=0; i<np; ++i)
|
||||
{
|
||||
G4double dd = fPlanes[i].a*p.x() + fPlanes[i].b*p.y() + fPlanes[i].d;
|
||||
if (dd > dist) dist = dd;
|
||||
@@ -1474,7 +1474,7 @@ G4ExtrudedSolid::CalculateExtent(const EAxis pAxis,
|
||||
// main loop along triangles
|
||||
pMin = kInfinity;
|
||||
pMax = -kInfinity;
|
||||
G4int ntria = triangles.size()/3;
|
||||
G4int ntria = (G4int)triangles.size()/3;
|
||||
for (G4int i=0; i<ntria; ++i)
|
||||
{
|
||||
G4int i3 = i*3;
|
||||
@@ -1518,7 +1518,7 @@ G4ExtrudedSolid::CalculateExtent(const EAxis pAxis,
|
||||
|
||||
std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
|
||||
{
|
||||
G4int oldprc = os.precision(16);
|
||||
G4long oldprc = os.precision(16);
|
||||
os << "-----------------------------------------------------------\n"
|
||||
<< " *** Dump for solid - " << GetName() << " ***\n"
|
||||
<< " ===================================================\n"
|
||||
@@ -1529,7 +1529,7 @@ std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
|
||||
else
|
||||
{ os << " Concave polygon; list of vertices:" << G4endl; }
|
||||
|
||||
for ( G4int i=0; i<fNv; ++i )
|
||||
for ( std::size_t i=0; i<fNv; ++i )
|
||||
{
|
||||
os << std::setw(5) << "#" << i
|
||||
<< " vx = " << fPolygon[i].x()/mm << " mm"
|
||||
@@ -1537,7 +1537,7 @@ std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
|
||||
}
|
||||
|
||||
os << " Sections:" << G4endl;
|
||||
for ( G4int iz=0; iz<fNz; ++iz )
|
||||
for ( std::size_t iz=0; iz<fNz; ++iz )
|
||||
{
|
||||
os << " z = " << fZSections[iz].fZ/mm << " mm "
|
||||
<< " x0= " << fZSections[iz].fOffset.x()/mm << " mm "
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user